ClientApp Mails view

This commit is contained in:
ShabOl 2024-04-19 21:41:12 +04:00
parent 0b7edbd7a0
commit a5df68d9df
3 changed files with 65 additions and 0 deletions

View File

@ -156,5 +156,16 @@ namespace AutoWorkshopClientApp.Controllers
RepairViewModel? Repair = ApiClient.GetRequest<RepairViewModel>($"api/main/getrepair?repairId={repair}");
return count * (Repair?.Price ?? 1);
}
[HttpGet]
public IActionResult Mails()
{
if (ApiClient.Client == null)
{
return Redirect("~/Home/Enter");
}
return View(ApiClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={ApiClient.Client.Id}"));
}
}
}

View File

@ -0,0 +1,51 @@
@using AutoWorkshopContracts.ViewModels
@model List<MessageInfoViewModel>
@{
ViewData["Title"] = "Mails";
}
<div class="text-center">
<h1 class="display-4">Заказы</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<table class="table">
<thead>
<tr>
<th>
Дата письма
</th>
<th>
Заголовок
</th>
<th>
Текст
</th>
</tr>
</thead>
<tbody>
@foreach (var Item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => Item.DateDelivery)
</td>
<td>
@Html.DisplayFor(modelItem => Item.Subject)
</td>
<td>
@Html.DisplayFor(modelItem => Item.Body)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -26,6 +26,9 @@
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
</li>
<li>
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Mails">Письма</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Вход</a>
</li>