From a5df68d9dfb3f9edc964a62c7632a30e8d9f100a Mon Sep 17 00:00:00 2001 From: Oleg Shabunov Date: Fri, 19 Apr 2024 21:41:12 +0400 Subject: [PATCH] ClientApp Mails view --- .../Controllers/HomeController.cs | 11 ++++ AutoWorkshopClientApp/Views/Home/Mails.cshtml | 51 +++++++++++++++++++ .../Views/Shared/_Layout.cshtml | 3 ++ 3 files changed, 65 insertions(+) create mode 100644 AutoWorkshopClientApp/Views/Home/Mails.cshtml diff --git a/AutoWorkshopClientApp/Controllers/HomeController.cs b/AutoWorkshopClientApp/Controllers/HomeController.cs index 52826de..b2e4e1e 100644 --- a/AutoWorkshopClientApp/Controllers/HomeController.cs +++ b/AutoWorkshopClientApp/Controllers/HomeController.cs @@ -156,5 +156,16 @@ namespace AutoWorkshopClientApp.Controllers RepairViewModel? Repair = ApiClient.GetRequest($"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>($"api/client/getmessages?clientId={ApiClient.Client.Id}")); + } } } diff --git a/AutoWorkshopClientApp/Views/Home/Mails.cshtml b/AutoWorkshopClientApp/Views/Home/Mails.cshtml new file mode 100644 index 0000000..ab4764e --- /dev/null +++ b/AutoWorkshopClientApp/Views/Home/Mails.cshtml @@ -0,0 +1,51 @@ +@using AutoWorkshopContracts.ViewModels + +@model List +@{ + ViewData["Title"] = "Mails"; +} + +
+

Заказы

+
+ +
+ @{ + if (Model == null) + { +

Авторизируйтесь

+ return; + } + + + + + + + + + + @foreach (var Item in Model) + { + + + + + + } + +
+ Дата письма + + Заголовок + + Текст +
+ @Html.DisplayFor(modelItem => Item.DateDelivery) + + @Html.DisplayFor(modelItem => Item.Subject) + + @Html.DisplayFor(modelItem => Item.Body) +
+ } +
diff --git a/AutoWorkshopClientApp/Views/Shared/_Layout.cshtml b/AutoWorkshopClientApp/Views/Shared/_Layout.cshtml index 14e847b..6297fac 100644 --- a/AutoWorkshopClientApp/Views/Shared/_Layout.cshtml +++ b/AutoWorkshopClientApp/Views/Shared/_Layout.cshtml @@ -26,6 +26,9 @@ +
  • + Письма +