Лабораторная_7

This commit is contained in:
yuliya.mavrina@internet.ru 2024-05-15 08:37:13 +03:00
parent af3261f0cb
commit 6bdc77b685
3 changed files with 4 additions and 10 deletions

View File

@ -13,8 +13,7 @@ namespace RenovationWorkClientApp
{ {
_client.BaseAddress = new Uri(configuration["IPAddress"]); _client.BaseAddress = new Uri(configuration["IPAddress"]);
_client.DefaultRequestHeaders.Accept.Clear(); _client.DefaultRequestHeaders.Accept.Clear();
_client.DefaultRequestHeaders.Accept.Add(new _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
MediaTypeWithQualityHeaderValue("application/json"));
} }
public static T? GetRequest<T>(string requestUrl) public static T? GetRequest<T>(string requestUrl)
{ {

View File

@ -125,8 +125,7 @@ namespace RenovationWorkClientApp.Controllers
{ {
throw new Exception("Количество и сумма должны быть\r\nбольше 0"); throw new Exception("Количество и сумма должны быть\r\nбольше 0");
} }
APIClient.PostRequest("api/main/createorder", new APIClient.PostRequest("api/main/createorder", new OrderBindingModel
OrderBindingModel
{ {
ClientId = APIClient.Client.Id, ClientId = APIClient.Client.Id,
RepairId = repair, RepairId = repair,
@ -148,8 +147,7 @@ namespace RenovationWorkClientApp.Controllers
{ {
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
} }
return return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
} }
} }
} }

View File

@ -55,10 +55,7 @@ namespace RenovationWorkRestApi.Controllers
{ {
try try
{ {
return _mailLogic.ReadList(new MessageInfoSearchModel return _mailLogic.ReadList(new MessageInfoSearchModel{ ClientId = clientId });
{
ClientId = clientId
});
} }
catch (Exception ex) catch (Exception ex)
{ {