Форма обновления заявок работает
This commit is contained in:
parent
4721aed1c9
commit
3a0491b54d
@ -23,7 +23,10 @@ namespace BankClientApp
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(result);
|
||||
return JsonConvert.DeserializeObject<T>(result, new JsonSerializerSettings {
|
||||
TypeNameHandling = Newtonsoft.Json.TypeNameHandling.All,
|
||||
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -427,7 +427,7 @@ namespace BankClientApp.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void RequestUpdate(int sum, List<int> cards)
|
||||
public void RequestUpdate(int request, int sum, List<int> cards)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
@ -438,6 +438,7 @@ namespace BankClientApp.Controllers
|
||||
}
|
||||
APIClient.PostRequest("/api/request/updaterequest", new RequestBindingModel
|
||||
{
|
||||
Id = request,
|
||||
Sum = sum,
|
||||
CardRequests = a,
|
||||
Status = RequestStatus.Неизвестен
|
||||
@ -471,6 +472,22 @@ namespace BankClientApp.Controllers
|
||||
Response.Redirect("Request");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public RequestViewModel? GetRequest(int requestId)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
var result = APIClient.GetRequest<RequestViewModel>($"api/request/getrequest?requestid={requestId}");
|
||||
result.CardRequests = null;
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region//работа с отчетами
|
||||
|
@ -40,23 +40,26 @@
|
||||
{
|
||||
<script>
|
||||
function check() {
|
||||
var cards = $('#cards').val();
|
||||
var request = $('#request').val();
|
||||
$("#cards option:selected").removeAttr("selected");
|
||||
if (cards && request) {
|
||||
if (request) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetCards",
|
||||
data: { requestId: request },
|
||||
success: function (result) {
|
||||
$.map(result, function (n) {
|
||||
$(`option[data-name=${n}]`).attr("selected", "selected")
|
||||
$(`option[value=${n}]`).attr("selected", "selected")
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
$.ajax({
|
||||
|
||||
method: "GET",
|
||||
url: "/Home/GetRequest",
|
||||
data: {requestId: request},
|
||||
success: function (result) {
|
||||
$('#sum').val(result.sum)
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace BankDatabaseImplement.Implements
|
||||
{
|
||||
if (!model.Id.HasValue) return null;
|
||||
using var context = new BankDatabase();
|
||||
return context.Requests.Include(x => x.Cards).ThenInclude(x => x.Card)
|
||||
return context.Requests.Include(x => x.Cards).ThenInclude(x => x.Card).ToList()
|
||||
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
public RequestViewModel? Insert(RequestBindingModel model)
|
||||
|
@ -37,10 +37,12 @@ namespace BankRestApi.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadElement(new RequestSearchModel
|
||||
var tmp = _logic.ReadElement(new RequestSearchModel
|
||||
{
|
||||
Id = RequestId
|
||||
});
|
||||
tmp.CardRequests = null;
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user