From 8e9e4dd321ba69146b01903a65a245b54a99cea8 Mon Sep 17 00:00:00 2001 From: Sergey Kozyrev Date: Tue, 30 Apr 2024 00:44:32 +0400 Subject: [PATCH] ViewUpdate Around the world, around the world Around the world, around the world Around the world, around the world Around the world, around the world --- .../Contracts/ViewModels/DetailTimeReport.cs | 15 ++++ .../DetailWorkshopReportViewModel.cs | 8 ++ .../Controllers/HomeController.cs | 87 ++++++++++++++++++- .../Views/Home/CreateProduct.cshtml | 54 +++++++++--- .../Views/Home/CreateProduction.cshtml | 52 ++++++++--- .../Views/Home/DetailTimeReport.cshtml | 50 +++++++++++ .../Views/Home/DetailWorkshopReport.cshtml | 42 +++++++++ Course/ImplementerApp/Views/Home/Enter.cshtml | 2 +- Course/ImplementerApp/Views/Home/Index.cshtml | 1 + .../Views/Home/IndexDetail.cshtml | 1 - .../Views/Home/IndexProduct.cshtml | 1 + .../Views/Home/IndexProduction.cshtml | 1 - .../Views/Home/ProductMachineAdd.cshtml | 31 +++++++ .../Views/Home/ReportsMenu.cshtml | 5 +- 14 files changed, 313 insertions(+), 37 deletions(-) create mode 100644 Course/Contracts/ViewModels/DetailTimeReport.cs create mode 100644 Course/Contracts/ViewModels/DetailWorkshopReportViewModel.cs create mode 100644 Course/ImplementerApp/Views/Home/DetailTimeReport.cshtml create mode 100644 Course/ImplementerApp/Views/Home/DetailWorkshopReport.cshtml create mode 100644 Course/ImplementerApp/Views/Home/ProductMachineAdd.cshtml diff --git a/Course/Contracts/ViewModels/DetailTimeReport.cs b/Course/Contracts/ViewModels/DetailTimeReport.cs new file mode 100644 index 0000000..f67f569 --- /dev/null +++ b/Course/Contracts/ViewModels/DetailTimeReport.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.ViewModels +{ + public class DetailTimeReport + { + public string DetailName { get; set; } = string.Empty; + public List Productions { get; set; } = new(); + public List Machines { get; set; } = new(); + } +} diff --git a/Course/Contracts/ViewModels/DetailWorkshopReportViewModel.cs b/Course/Contracts/ViewModels/DetailWorkshopReportViewModel.cs new file mode 100644 index 0000000..3ca6483 --- /dev/null +++ b/Course/Contracts/ViewModels/DetailWorkshopReportViewModel.cs @@ -0,0 +1,8 @@ +namespace Contracts.ViewModels +{ + public class DetailWorkshopReportViewModel + { + public string DetailName { get; set; } = string.Empty; + public List WorkShops { get; set; } = new(); + } +} diff --git a/Course/ImplementerApp/Controllers/HomeController.cs b/Course/ImplementerApp/Controllers/HomeController.cs index c18b673..9d2d9b0 100644 --- a/Course/ImplementerApp/Controllers/HomeController.cs +++ b/Course/ImplementerApp/Controllers/HomeController.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using BusinessLogic.BusinessLogic; using Contracts.BusinessLogicsContracts; using Contracts.ViewModels; +using DataModels.Models; namespace ImplementerApp.Controllers { @@ -35,7 +36,22 @@ namespace ImplementerApp.Controllers } public IActionResult IndexDetail() { - return View(new List()); + var details = new List(); + details.Add(new DetailViewModel + { + Id = 1, + Name = "Test", + Cost = 55.5, + UserId = 1 + }); + details.Add(new DetailViewModel + { + Id = 2, + Name = "Test1", + Cost = 32, + UserId = 2 + }); + return View(details); } public IActionResult CreateDetail() { @@ -48,7 +64,22 @@ namespace ImplementerApp.Controllers } public IActionResult CreateProduct() { - return View(); + var details = new List(); + details.Add(new DetailViewModel + { + Id = 1, + Name = "Test", + Cost = 55.5, + UserId = 1 + }); + details.Add(new DetailViewModel + { + Id = 2, + Name = "Test1", + Cost = 32, + UserId = 2 + }); + return View(details); } public IActionResult IndexProduction() { @@ -56,12 +87,62 @@ namespace ImplementerApp.Controllers } public IActionResult CreateProduction() { - return View(); + var details = new List(); + details.Add(new DetailViewModel + { + Id = 1, + Name = "Test", + Cost = 55.5, + UserId = 1 + }); + details.Add(new DetailViewModel + { + Id = 2, + Name = "Test1", + Cost = 32, + UserId = 2 + }); + return View(details); } public IActionResult Privacy() { return View(); } + public IActionResult DetailTimeReport() + { + return View(new List()); + } + public IActionResult DetailWorkshopReport() + { + return View(new List()); + } + public IActionResult ReportsMenu() + { + return View(); + } + public IActionResult ProductMachineAdd() + { + List machines = new List + { + new MachineViewModel + { + Id = 1, + Title = "Токарный станок", + Country = "Германия", + UserId = 1, + WorkerMachines = new() + }, + new MachineViewModel + { + Id = 2, + Title = "Фрезерный станок", + Country = "Япония", + UserId = 2, + WorkerMachines = new() + } + }; + return View(machines); + } [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() diff --git a/Course/ImplementerApp/Views/Home/CreateProduct.cshtml b/Course/ImplementerApp/Views/Home/CreateProduct.cshtml index d282278..bb0a870 100644 --- a/Course/ImplementerApp/Views/Home/CreateProduct.cshtml +++ b/Course/ImplementerApp/Views/Home/CreateProduct.cshtml @@ -1,4 +1,8 @@ -@{ +@using Contracts.ViewModels + +@model List + +@{ ViewData["Title"] = "CreateProduct"; }
@@ -9,18 +13,32 @@
Название:
-
- - @foreach (var detail in ViewBag.Details) - { -
- - -
- } +
+
Details
+
+ + + + + + + + + @foreach (var detail in Model) + { + + + + + + } + +
ВыборНазвание
+ + @detail.Name + +
+
Сумма:
@@ -30,4 +48,12 @@
- \ No newline at end of file + + + + + \ No newline at end of file diff --git a/Course/ImplementerApp/Views/Home/CreateProduction.cshtml b/Course/ImplementerApp/Views/Home/CreateProduction.cshtml index 707df99..fa8cd21 100644 --- a/Course/ImplementerApp/Views/Home/CreateProduction.cshtml +++ b/Course/ImplementerApp/Views/Home/CreateProduction.cshtml @@ -1,4 +1,8 @@ -@{ +@using Contracts.ViewModels + +@model List + +@{ ViewData["Title"] = "CreateProduction"; }
@@ -9,18 +13,30 @@
Название:
-
- - @foreach (var detail in ViewBag.Details) - { -
- - -
- } +
+
Details
+
+ + + + + + + + + + @foreach (var detail in Model) + { + + + + + } + +
ВыборНазваниеКоличество
+ + @detail.Name
+
Сумма:
@@ -30,4 +46,12 @@
- \ No newline at end of file + + + + + \ No newline at end of file diff --git a/Course/ImplementerApp/Views/Home/DetailTimeReport.cshtml b/Course/ImplementerApp/Views/Home/DetailTimeReport.cshtml new file mode 100644 index 0000000..75c992f --- /dev/null +++ b/Course/ImplementerApp/Views/Home/DetailTimeReport.cshtml @@ -0,0 +1,50 @@ +@using Contracts.ViewModels + +@model List + +@{ + ViewData["Title"] = "Details on Time Reports"; +} + +
+

Список деталей в диапазоне времени

+
+ +
+ +
+ + + + + + + + + + + + @foreach (var detail in Model) + { + + + + + + } + +
ДетальСтанкиПроизводства
@detail.DetailName +
    + @foreach (var machine in detail.Machines) + { +
  • @machine
  • + } +
+
+
    + @foreach (var production in detail.Productions) + { +
  • @production
  • + } +
+
diff --git a/Course/ImplementerApp/Views/Home/DetailWorkshopReport.cshtml b/Course/ImplementerApp/Views/Home/DetailWorkshopReport.cshtml new file mode 100644 index 0000000..6dd7ace --- /dev/null +++ b/Course/ImplementerApp/Views/Home/DetailWorkshopReport.cshtml @@ -0,0 +1,42 @@ +@using Contracts.ViewModels + +@model List + +@{ + ViewData["Title"] = "Details - Workshop Reports"; +} +
+

Список деталей с отображением цехов

+
+ +
+ +
+
+ +
+ + + + + + + + + + @foreach (var detail in Model) + { + + + + + } + +
ДетальЦех
@detail.DetailName +
    + @foreach (var workshop in detail.WorkShops) + { +
  • @workshop
  • + } +
+
diff --git a/Course/ImplementerApp/Views/Home/Enter.cshtml b/Course/ImplementerApp/Views/Home/Enter.cshtml index 106d3d5..2d351bc 100644 --- a/Course/ImplementerApp/Views/Home/Enter.cshtml +++ b/Course/ImplementerApp/Views/Home/Enter.cshtml @@ -18,4 +18,4 @@
- \ No newline at end of file + \ No newline at end of file diff --git a/Course/ImplementerApp/Views/Home/Index.cshtml b/Course/ImplementerApp/Views/Home/Index.cshtml index 25ce51c..b3e0f4b 100644 --- a/Course/ImplementerApp/Views/Home/Index.cshtml +++ b/Course/ImplementerApp/Views/Home/Index.cshtml @@ -9,6 +9,7 @@ Изделия Производства Личные данные + Меню отчетов Вход Регистрация
diff --git a/Course/ImplementerApp/Views/Home/IndexDetail.cshtml b/Course/ImplementerApp/Views/Home/IndexDetail.cshtml index 2725623..f8a9c80 100644 --- a/Course/ImplementerApp/Views/Home/IndexDetail.cshtml +++ b/Course/ImplementerApp/Views/Home/IndexDetail.cshtml @@ -10,7 +10,6 @@

Детали

-
@{ if (Model == null) diff --git a/Course/ImplementerApp/Views/Home/IndexProduct.cshtml b/Course/ImplementerApp/Views/Home/IndexProduct.cshtml index 1f596f5..2f1be6b 100644 --- a/Course/ImplementerApp/Views/Home/IndexProduct.cshtml +++ b/Course/ImplementerApp/Views/Home/IndexProduct.cshtml @@ -10,6 +10,7 @@

Изедлия

+Привязать станок к изделию
@{ diff --git a/Course/ImplementerApp/Views/Home/IndexProduction.cshtml b/Course/ImplementerApp/Views/Home/IndexProduction.cshtml index 5176967..6bdc916 100644 --- a/Course/ImplementerApp/Views/Home/IndexProduction.cshtml +++ b/Course/ImplementerApp/Views/Home/IndexProduction.cshtml @@ -10,7 +10,6 @@

Производства

-
@{ if (Model == null) diff --git a/Course/ImplementerApp/Views/Home/ProductMachineAdd.cshtml b/Course/ImplementerApp/Views/Home/ProductMachineAdd.cshtml new file mode 100644 index 0000000..37daa6a --- /dev/null +++ b/Course/ImplementerApp/Views/Home/ProductMachineAdd.cshtml @@ -0,0 +1,31 @@ +@using Contracts.ViewModels + +@model List + +@{ + ViewData["Title"] = "Product-Add-Machine"; +} + +
+

Изделие - @ViewBag.Product

+
+ +
+

Список изделий

+
+ @foreach (var machine in Model) + { +
+
+
+
@machine.Title
+
+ + +
+
+
+
+ } +
+
\ No newline at end of file diff --git a/Course/ImplementerApp/Views/Home/ReportsMenu.cshtml b/Course/ImplementerApp/Views/Home/ReportsMenu.cshtml index f60baa0..caac5d0 100644 --- a/Course/ImplementerApp/Views/Home/ReportsMenu.cshtml +++ b/Course/ImplementerApp/Views/Home/ReportsMenu.cshtml @@ -5,8 +5,7 @@