This commit is contained in:
Николай 2023-04-02 19:30:57 +04:00
parent 3db96eaaa1
commit f749e8fcb4
2 changed files with 1 additions and 45 deletions

View File

@ -45,12 +45,6 @@
<h2 class="display-4">Покупки</h2> <h2 class="display-4">Покупки</h2>
</div> </div>
<div class="text-center" name="id"> <div class="text-center" name="id">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@ -72,26 +66,6 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.DatePurchase)
</td>
<td>
@Html.DisplayFor(modelItem => item.Sum)
</td>
<td>
@Html.DisplayFor(modelItem => item.PurchaseStatus)
</td>
<td>
@Html.DisplayFor(modelItem => item.UserLogin)
</td>
</tr>
}
</tbody> </tbody>
</table> </table>
} }

View File

@ -15,13 +15,10 @@ namespace HardwareShopRestApi.Controllers
private readonly IUserLogic _logic; private readonly IUserLogic _logic;
private readonly IPurchaseLogic _purchaseLogic; public ClientController(IUserLogic logic, ILogger<ClientController> logger)
public ClientController(IUserLogic logic, IPurchaseLogic purchaseLogic, ILogger<ClientController> logger)
{ {
_logger = logger; _logger = logger;
_logic = logic; _logic = logic;
_purchaseLogic = purchaseLogic;
} }
[HttpGet] [HttpGet]
@ -55,20 +52,5 @@ namespace HardwareShopRestApi.Controllers
throw; throw;
} }
} }
[HttpGet]
public List<PurchaseViewModel>? GetPurchases(int userId)
{
try
{
return _purchaseLogic.ReadList(new PurchaseSearchModel { UserId = userId });
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения списка заказов клиента id={Id}", userId);
throw;
}
}
} }
} }