From b8bc72fe37f431d6a0c57826aa006dd804e93c7c Mon Sep 17 00:00:00 2001 From: 1yuee Date: Tue, 31 Jan 2023 13:12:06 +0400 Subject: [PATCH] ConfectioneryContracts > ViewModels --- .../ConfectioneryContracts.csproj | 2 - .../SearchModels/ComponentSearchModel.cs | 15 ++++++++ .../SearchModels/OrderSearchModel.cs | 13 +++++++ .../SearchModels/ProductSearchModel.cs | 15 ++++++++ .../ViewModels/ComponentViewModel.cs | 21 +++++++++++ .../ViewModels/OrderViewModel.cs | 37 +++++++++++++++++++ .../ViewModels/ProductViewModel.cs | 23 ++++++++++++ 7 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 Confectionery/ConfectioneryContracts/SearchModels/ComponentSearchModel.cs create mode 100644 Confectionery/ConfectioneryContracts/SearchModels/OrderSearchModel.cs create mode 100644 Confectionery/ConfectioneryContracts/SearchModels/ProductSearchModel.cs create mode 100644 Confectionery/ConfectioneryContracts/ViewModels/ComponentViewModel.cs create mode 100644 Confectionery/ConfectioneryContracts/ViewModels/OrderViewModel.cs create mode 100644 Confectionery/ConfectioneryContracts/ViewModels/ProductViewModel.cs diff --git a/Confectionery/ConfectioneryContracts/ConfectioneryContracts.csproj b/Confectionery/ConfectioneryContracts/ConfectioneryContracts.csproj index 94665f9..1bf7525 100644 --- a/Confectionery/ConfectioneryContracts/ConfectioneryContracts.csproj +++ b/Confectionery/ConfectioneryContracts/ConfectioneryContracts.csproj @@ -12,9 +12,7 @@ - - diff --git a/Confectionery/ConfectioneryContracts/SearchModels/ComponentSearchModel.cs b/Confectionery/ConfectioneryContracts/SearchModels/ComponentSearchModel.cs new file mode 100644 index 0000000..5cc1374 --- /dev/null +++ b/Confectionery/ConfectioneryContracts/SearchModels/ComponentSearchModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConfectioneryContracts.SearchModels +{ + public class ComponentSearchModel + { + public int? Id { get; set; } + + public string? ComponentName { get; set; } + } +} diff --git a/Confectionery/ConfectioneryContracts/SearchModels/OrderSearchModel.cs b/Confectionery/ConfectioneryContracts/SearchModels/OrderSearchModel.cs new file mode 100644 index 0000000..9393fab --- /dev/null +++ b/Confectionery/ConfectioneryContracts/SearchModels/OrderSearchModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConfectioneryContracts.SearchModels +{ + public class OrderSearchModel + { + public int? Id { get; set; } + } +} diff --git a/Confectionery/ConfectioneryContracts/SearchModels/ProductSearchModel.cs b/Confectionery/ConfectioneryContracts/SearchModels/ProductSearchModel.cs new file mode 100644 index 0000000..56afdb9 --- /dev/null +++ b/Confectionery/ConfectioneryContracts/SearchModels/ProductSearchModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConfectioneryContracts.SearchModels +{ + public class ProductSearchModel + { + public int? Id { get; set; } + + public string? ProductName { get; set; } + } +} diff --git a/Confectionery/ConfectioneryContracts/ViewModels/ComponentViewModel.cs b/Confectionery/ConfectioneryContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..8706c51 --- /dev/null +++ b/Confectionery/ConfectioneryContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,21 @@ +using ConfectioneryDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConfectioneryContracts.ViewModels +{ + public class ComponentViewModel : IComponentModel + { + public int Id { get; set; } + + [DisplayName("Название компонента")] + public string ComponentName { get; set; } = string.Empty; + + [DisplayName("Цена")] + public double Cost { get; set; } + } +} diff --git a/Confectionery/ConfectioneryContracts/ViewModels/OrderViewModel.cs b/Confectionery/ConfectioneryContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..4c3711d --- /dev/null +++ b/Confectionery/ConfectioneryContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,37 @@ +using ConfectioneryDataModels.Enums; +using ConfectioneryDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConfectioneryContracts.ViewModels +{ + public class OrderViewModel : IOrderModel + { + [DisplayName("Номер")] + public int Id { get; set; } + + public int ProductId { get; set; } + + [DisplayName("Изделие")] + public string ProductName { get; set; } = string.Empty; + + [DisplayName("Количество")] + public int Count { get; set; } + + [DisplayName("Сумма")] + public double Sum { get; set; } + + [DisplayName("Статус")] + public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; + + [DisplayName("Дата создания")] + public DateTime DateCreate { get; set; } = DateTime.Now; + + [DisplayName("Дата выполнения")] + public DateTime? DateImplement { get; set; } + } +} diff --git a/Confectionery/ConfectioneryContracts/ViewModels/ProductViewModel.cs b/Confectionery/ConfectioneryContracts/ViewModels/ProductViewModel.cs new file mode 100644 index 0000000..961999e --- /dev/null +++ b/Confectionery/ConfectioneryContracts/ViewModels/ProductViewModel.cs @@ -0,0 +1,23 @@ +using ConfectioneryDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConfectioneryContracts.ViewModels +{ + public class ProductViewModel : IProductModel + { + public int Id { get; set; } + + [DisplayName("Название изделия")] + public string ProductName { get; set; } = string.Empty; + + [DisplayName("Цена")] + public double Price { get; set; } + + public Dictionary ProductComponents { get; set; } = new(); + } +}