diff --git a/Canteen/CanteenManagerApp/Controllers/HomeController.cs b/Canteen/CanteenManagerApp/Controllers/HomeController.cs index 4dead79..a632222 100644 --- a/Canteen/CanteenManagerApp/Controllers/HomeController.cs +++ b/Canteen/CanteenManagerApp/Controllers/HomeController.cs @@ -344,7 +344,7 @@ namespace CanteenManagerApp.Controllers } [HttpPost] - public void DishCreate(string name) + public void DishCreate(string name, int price) { if (APIClient.Manager == null) { @@ -356,10 +356,16 @@ namespace CanteenManagerApp.Controllers throw new Exception("Наименование блюда не должно быть пустым"); } + if (price <= 0) + { + throw new Exception("Цена блюда должна быть больше нуля"); + } + APIClient.PostRequest("api/main/dishcreate", new DishBindingModel { ManagerId = APIClient.Manager.Id, - DishName = name + DishName = name, + Price = price }); Response.Redirect("DishList"); @@ -484,7 +490,7 @@ namespace CanteenManagerApp.Controllers public void ReportPdf(ReportBindingModel model) { model.UserId = APIClient.Manager.Id; - APIClient.PostRequest("api/main/SaveOrdersToPDF", model); + APIClient.PostRequest("api/main/SaveCooksToPDF", model); Response.Redirect("Index"); } @@ -492,7 +498,7 @@ namespace CanteenManagerApp.Controllers public void ReportXsl(ReportBindingModel model) { model.UserId = APIClient.Manager.Id; - APIClient.PostRequest("api/main/SavevToXSL", model); + APIClient.PostRequest("api/main/SaveOrdersToXSL", model); Response.Redirect("Index"); } diff --git a/Canteen/CanteenManagerApp/Views/Home/CookUpdate.cshtml b/Canteen/CanteenManagerApp/Views/Home/CookUpdate.cshtml index 329a04d..da5d4c6 100644 --- a/Canteen/CanteenManagerApp/Views/Home/CookUpdate.cshtml +++ b/Canteen/CanteenManagerApp/Views/Home/CookUpdate.cshtml @@ -2,6 +2,9 @@ @{ ViewData["Title"] = "CookUpdate"; } +
+ +

Данные повара

@@ -12,11 +15,11 @@
ФИО:
-
+
Должность:
-
+
@@ -24,21 +27,22 @@
\ No newline at end of file diff --git a/Canteen/CanteenManagerApp/Views/Home/DishCreate.cshtml b/Canteen/CanteenManagerApp/Views/Home/DishCreate.cshtml index f181adf..e335791 100644 --- a/Canteen/CanteenManagerApp/Views/Home/DishCreate.cshtml +++ b/Canteen/CanteenManagerApp/Views/Home/DishCreate.cshtml @@ -17,6 +17,12 @@ +
+
Цена блюда:
+
+ +
+
diff --git a/Canteen/CanteenManagerApp/Views/Home/DishUpdate.cshtml b/Canteen/CanteenManagerApp/Views/Home/DishUpdate.cshtml index 0cbc94a..1bf96e5 100644 --- a/Canteen/CanteenManagerApp/Views/Home/DishUpdate.cshtml +++ b/Canteen/CanteenManagerApp/Views/Home/DishUpdate.cshtml @@ -1,21 +1,25 @@ -@{ +@using Newtonsoft.Json; +@{ ViewData["Title"] = "DishUpdate"; } +
+ +

Данные блюда

Блюдо:
-
+
Название:
-
+
Цена:
-
+
@@ -23,16 +27,22 @@
\ No newline at end of file diff --git a/Canteen/CanteenManagerApp/Views/Home/ProductUpdate.cshtml b/Canteen/CanteenManagerApp/Views/Home/ProductUpdate.cshtml index 40e9fd7..b320880 100644 --- a/Canteen/CanteenManagerApp/Views/Home/ProductUpdate.cshtml +++ b/Canteen/CanteenManagerApp/Views/Home/ProductUpdate.cshtml @@ -1,6 +1,10 @@ -@{ +@using Newtonsoft.Json; +@{ ViewData["Title"] = "ProductUpdate"; } +
+ +

Данные продукта

@@ -11,11 +15,11 @@
ФИО:
-
+
Цена:
-
+
@@ -23,16 +27,22 @@
\ No newline at end of file diff --git a/Canteen/CanteenRestApi/Controllers/MainController.cs b/Canteen/CanteenRestApi/Controllers/MainController.cs index 4b6ee1a..fad95dc 100644 --- a/Canteen/CanteenRestApi/Controllers/MainController.cs +++ b/Canteen/CanteenRestApi/Controllers/MainController.cs @@ -55,7 +55,7 @@ namespace CanteenRestApi.Controllers } } [HttpPost] - public void SaveOrdersToPDF(ReportBindingModel model) + public void SaveCooksToPDF(ReportBindingModel model) { try { @@ -619,6 +619,19 @@ namespace CanteenRestApi.Controllers } } [HttpGet] + public LunchViewModel GetLunch(int lunchId) + { + try + { + return _lunch.ReadElement(new LunchSearchModel { Id = lunchId }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error during loading list of bouquets"); + throw; + } + } + [HttpGet] public GraphicViewModel[] GetGraphic() { return new GraphicViewModel[] diff --git a/Canteen/CanteenVisitorApp/Controllers/HomeController.cs b/Canteen/CanteenVisitorApp/Controllers/HomeController.cs index 97c6905..d3d4ddf 100644 --- a/Canteen/CanteenVisitorApp/Controllers/HomeController.cs +++ b/Canteen/CanteenVisitorApp/Controllers/HomeController.cs @@ -530,6 +530,7 @@ namespace CanteenVisitorApp.Controllers [HttpGet] public IActionResult Report() { + ViewBag.LunchList = APIClient.GetRequest>($"api/main/getlunchlist?visitorId={APIClient.Visitor.Id}"); return View(new ReportBindingModel()); } [HttpPost] @@ -559,6 +560,13 @@ namespace CanteenVisitorApp.Controllers [HttpPost] public void ReportEmail(ReportBindingModel model) { + model.UserId = APIClient.Visitor.Id; + APIClient.PostRequest($"api/visitor/SendEmail", new MailSendInfoBindingModel + { + MailAddress = APIClient.Visitor.Login, + Subject = "Отчет", + report = model + }); APIClient.PostRequest("api/main/SaveCooksToEMAIL", model); Response.Redirect("Index"); } diff --git a/Canteen/CanteenVisitorApp/Views/Home/Report.cshtml b/Canteen/CanteenVisitorApp/Views/Home/Report.cshtml index f34fc8b..eee8119 100644 --- a/Canteen/CanteenVisitorApp/Views/Home/Report.cshtml +++ b/Canteen/CanteenVisitorApp/Views/Home/Report.cshtml @@ -5,27 +5,38 @@ ViewBag.Title = "Report"; } -

Generate Report

+

Отчеты

@using (Html.BeginForm("Report", "Home", FormMethod.Post)) { -
- @Html.LabelFor(m => m.FileName) - @Html.TextBoxFor(m => m.FileName) +
+

Pdf

+
+
+ @Html.LabelFor(m => m.DateBefore, "От") + @Html.TextBoxFor(m => m.DateBefore, new { type = "date", @class = "form-control" }) +
+
+ +
+
+ @Html.LabelFor(m => m.DateAfter, "До") + @Html.TextBoxFor(m => m.DateAfter, new { type = "date", @class = "form-control" }) +
+
+
+
+ +
-
- @Html.LabelFor(m => m.DateAfter) - @Html.TextBoxFor(m => m.DateAfter, new { type = "date" }) +
+

Word, Excel

+
+ @Html.LabelFor(m => m.LunchId, "Выбранные обеды") + @Html.DropDownListFor(m => m.LunchId, new SelectList(ViewBag.LunchList, "Id", "LunchName"), new { @class = "form-control", multiple = "multiple" }) +
+ +
- -
- @Html.LabelFor(m => m.DateBefore) - @Html.TextBoxFor(m => m.DateBefore, new { type = "date" }) -
- - - - - } \ No newline at end of file diff --git a/Canteen/CanteenVisitorApp/Views/Home/UpdateLunch.cshtml b/Canteen/CanteenVisitorApp/Views/Home/UpdateLunch.cshtml index 31f6f98..902b742 100644 --- a/Canteen/CanteenVisitorApp/Views/Home/UpdateLunch.cshtml +++ b/Canteen/CanteenVisitorApp/Views/Home/UpdateLunch.cshtml @@ -2,6 +2,9 @@ @{ ViewData["Title"] = "UpdateLunch"; } +
+ +

Данные обеда

@@ -20,4 +23,23 @@
- \ No newline at end of file + + \ No newline at end of file diff --git a/Canteen/CanteenVisitorApp/Views/Home/UpdateOrder.cshtml b/Canteen/CanteenVisitorApp/Views/Home/UpdateOrder.cshtml index 1105eea..d0acf1f 100644 --- a/Canteen/CanteenVisitorApp/Views/Home/UpdateOrder.cshtml +++ b/Canteen/CanteenVisitorApp/Views/Home/UpdateOrder.cshtml @@ -2,13 +2,16 @@ @{ ViewData["Title"] = "UpdateOrder"; } +
+ +

Данные заказа

Заказ:
-
+
Пожелания:
@@ -20,4 +23,23 @@
-
\ No newline at end of file + + \ No newline at end of file diff --git a/Canteen/CanteenVisitorApp/Views/Home/UpdateTableware.cshtml b/Canteen/CanteenVisitorApp/Views/Home/UpdateTableware.cshtml index 7be07a8..8c3b2d2 100644 --- a/Canteen/CanteenVisitorApp/Views/Home/UpdateTableware.cshtml +++ b/Canteen/CanteenVisitorApp/Views/Home/UpdateTableware.cshtml @@ -2,13 +2,16 @@ @{ ViewData["Title"] = "UpdateTableware"; } +
+ +

Данные прибора

Прибор:
-
+
Название прибора:
@@ -20,23 +23,24 @@
-
@* + *@ \ No newline at end of file + $('#Id').val($('#Id option:first').val()).change(); + }); + \ No newline at end of file