From 4ab214e5401c9d0514c9eb41586f0032e147d64c Mon Sep 17 00:00:00 2001 From: Yourdax Date: Mon, 29 Apr 2024 20:02:11 +0400 Subject: [PATCH] Contracts + --- .../BindingModels/CardBindingModel.cs | 21 ++++++++++++++ .../BindingModels/ComponentBindingModel.cs | 15 ++++++++++ .../BindingModels/DrinkBindingModel.cs | 18 ++++++++++++ .../BindingModels/OrderBindingModel.cs | 25 ++++++++++++++++ .../BindingModels/ProductBindingModel.cs | 18 ++++++++++++ .../BindingModels/UserBindingModel.cs | 22 ++++++++++++++ .../BusinessLogicContracts/ICardLogic.cs | 21 ++++++++++++++ .../BusinessLogicContracts/IComponentLogic.cs | 19 ++++++++++++ .../BusinessLogicContracts/IDrinkLogic.cs | 19 ++++++++++++ .../BusinessLogicContracts/IOrderLogic.cs | 23 +++++++++++++++ .../BusinessLogicContracts/IProductLogic.cs | 19 ++++++++++++ .../BusinessLogicContracts/IUserLogic.cs | 20 +++++++++++++ .../DiningRoomContracts.csproj | 4 +++ .../SearchModels/CardSearchModel.cs | 11 +++++++ .../SearchModels/ComponentSearchModel.cs | 9 ++++++ .../SearchModels/DrinkSearchModel.cs | 11 +++++++ .../SearchModels/OrderSearchModel.cs | 25 ++++++++++++++++ .../SearchModels/ProductSearchModel.cs | 11 +++++++ .../SearchModels/UserSearchModel.cs | 20 +++++++++++++ .../StorageContracts/ICardStorage.cs | 21 ++++++++++++++ .../StorageContracts/IComponentStorage.cs | 21 ++++++++++++++ .../StorageContracts/IDrinkStorage.cs | 21 ++++++++++++++ .../StorageContracts/IOrderStorage.cs | 21 ++++++++++++++ .../StorageContracts/IProductStorage.cs | 21 ++++++++++++++ .../StorageContracts/IUserStorage.cs | 21 ++++++++++++++ .../ViewModels/CardViewModel.cs | 17 +++++++++++ .../ViewModels/ComponentViewModel.cs | 21 ++++++++++++++ .../ViewModels/DrinkViewModel.cs | 19 ++++++++++++ .../ViewModels/OrderViewModel.cs | 29 +++++++++++++++++++ .../ViewModels/ProductViewModel.cs | 19 ++++++++++++ .../ViewModels/UserViewModel.cs | 27 +++++++++++++++++ .../Models/IComponentModel.cs | 4 --- .../Models/IDrinkModel.cs | 2 +- .../Models/IProductModel.cs | 2 +- 34 files changed, 591 insertions(+), 6 deletions(-) create mode 100644 DiningRoom/DiningRoomContracts/BindingModels/CardBindingModel.cs create mode 100644 DiningRoom/DiningRoomContracts/BindingModels/ComponentBindingModel.cs create mode 100644 DiningRoom/DiningRoomContracts/BindingModels/DrinkBindingModel.cs create mode 100644 DiningRoom/DiningRoomContracts/BindingModels/OrderBindingModel.cs create mode 100644 DiningRoom/DiningRoomContracts/BindingModels/ProductBindingModel.cs create mode 100644 DiningRoom/DiningRoomContracts/BindingModels/UserBindingModel.cs create mode 100644 DiningRoom/DiningRoomContracts/BusinessLogicContracts/ICardLogic.cs create mode 100644 DiningRoom/DiningRoomContracts/BusinessLogicContracts/IComponentLogic.cs create mode 100644 DiningRoom/DiningRoomContracts/BusinessLogicContracts/IDrinkLogic.cs create mode 100644 DiningRoom/DiningRoomContracts/BusinessLogicContracts/IOrderLogic.cs create mode 100644 DiningRoom/DiningRoomContracts/BusinessLogicContracts/IProductLogic.cs create mode 100644 DiningRoom/DiningRoomContracts/BusinessLogicContracts/IUserLogic.cs create mode 100644 DiningRoom/DiningRoomContracts/SearchModels/CardSearchModel.cs create mode 100644 DiningRoom/DiningRoomContracts/SearchModels/ComponentSearchModel.cs create mode 100644 DiningRoom/DiningRoomContracts/SearchModels/DrinkSearchModel.cs create mode 100644 DiningRoom/DiningRoomContracts/SearchModels/OrderSearchModel.cs create mode 100644 DiningRoom/DiningRoomContracts/SearchModels/ProductSearchModel.cs create mode 100644 DiningRoom/DiningRoomContracts/SearchModels/UserSearchModel.cs create mode 100644 DiningRoom/DiningRoomContracts/StorageContracts/ICardStorage.cs create mode 100644 DiningRoom/DiningRoomContracts/StorageContracts/IComponentStorage.cs create mode 100644 DiningRoom/DiningRoomContracts/StorageContracts/IDrinkStorage.cs create mode 100644 DiningRoom/DiningRoomContracts/StorageContracts/IOrderStorage.cs create mode 100644 DiningRoom/DiningRoomContracts/StorageContracts/IProductStorage.cs create mode 100644 DiningRoom/DiningRoomContracts/StorageContracts/IUserStorage.cs create mode 100644 DiningRoom/DiningRoomContracts/ViewModels/CardViewModel.cs create mode 100644 DiningRoom/DiningRoomContracts/ViewModels/ComponentViewModel.cs create mode 100644 DiningRoom/DiningRoomContracts/ViewModels/DrinkViewModel.cs create mode 100644 DiningRoom/DiningRoomContracts/ViewModels/OrderViewModel.cs create mode 100644 DiningRoom/DiningRoomContracts/ViewModels/ProductViewModel.cs create mode 100644 DiningRoom/DiningRoomContracts/ViewModels/UserViewModel.cs diff --git a/DiningRoom/DiningRoomContracts/BindingModels/CardBindingModel.cs b/DiningRoom/DiningRoomContracts/BindingModels/CardBindingModel.cs new file mode 100644 index 0000000..924946d --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BindingModels/CardBindingModel.cs @@ -0,0 +1,21 @@ +using DiningRoomDataModels.Enums; +using DiningRoomDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.BindingModels +{ + public class CardBindingModel : ICardModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + public string CardName { get; set; } = string.Empty; + + public Dictionary DrinkCard { get; set; } = new(); + } +} diff --git a/DiningRoom/DiningRoomContracts/BindingModels/ComponentBindingModel.cs b/DiningRoom/DiningRoomContracts/BindingModels/ComponentBindingModel.cs new file mode 100644 index 0000000..b9139c8 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BindingModels/ComponentBindingModel.cs @@ -0,0 +1,15 @@ +using DiningRoomDataModels.Models; + +namespace DiningRoomContracts.BindingModels +{ + public class ComponentBindingModel : IComponentModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + public string ComponentName { get; set; } = string.Empty; + public string Unit { get; set; } = string.Empty; + public double Cost { get; set; } + } +} diff --git a/DiningRoom/DiningRoomContracts/BindingModels/DrinkBindingModel.cs b/DiningRoom/DiningRoomContracts/BindingModels/DrinkBindingModel.cs new file mode 100644 index 0000000..3eecd0a --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BindingModels/DrinkBindingModel.cs @@ -0,0 +1,18 @@ +using DiningRoomDataModels.Models; + +namespace DiningRoomContracts.BindingModels +{ + public class DrinkBindingModel : IDrinkModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + public string DrinkName { get; set; } = string.Empty; + + public double Cost { get; set; } + + public Dictionary ProductComponents { get; set; } = new(); + + } +} diff --git a/DiningRoom/DiningRoomContracts/BindingModels/OrderBindingModel.cs b/DiningRoom/DiningRoomContracts/BindingModels/OrderBindingModel.cs new file mode 100644 index 0000000..2135ded --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BindingModels/OrderBindingModel.cs @@ -0,0 +1,25 @@ +using DiningRoomDataModels.Enums; +using DiningRoomDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.BindingModels +{ + public class OrderBindingModel : IOrderModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + public DateTime DateCreate { get; set; } = DateTime.Now; + + public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; + public Dictionary ProductOrder { get; set; } = new(); + public Dictionary DrinkOrder { get; set; } = new(); + + public double Sum { get; set; } + } +} diff --git a/DiningRoom/DiningRoomContracts/BindingModels/ProductBindingModel.cs b/DiningRoom/DiningRoomContracts/BindingModels/ProductBindingModel.cs new file mode 100644 index 0000000..c4f4740 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BindingModels/ProductBindingModel.cs @@ -0,0 +1,18 @@ +using DiningRoomDataModels.Models; + +namespace DiningRoomContracts.BindingModels +{ + public class ProductBindingModel : IProductModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + public string ProductName { get; set; } = string.Empty; + + public double Cost { get; set; } + + public Dictionary ProductComponents { get; set; } = new(); + + } +} diff --git a/DiningRoom/DiningRoomContracts/BindingModels/UserBindingModel.cs b/DiningRoom/DiningRoomContracts/BindingModels/UserBindingModel.cs new file mode 100644 index 0000000..bf99d70 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BindingModels/UserBindingModel.cs @@ -0,0 +1,22 @@ +using DiningRoomDataModels.Enums; +using DiningRoomDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.BindingModels +{ + public class UserBindingModel : IUserModel + { + public int Id { get; set; } + + public string Login { get; set; } = string.Empty; + + public string Password { get; set; } = string.Empty; + + public string Email { get; set; } = string.Empty; + + } +} diff --git a/DiningRoom/DiningRoomContracts/BusinessLogicContracts/ICardLogic.cs b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/ICardLogic.cs new file mode 100644 index 0000000..c44d410 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/ICardLogic.cs @@ -0,0 +1,21 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.BusinessLogicContracts +{ + public interface ICardLogic + { + List? ReadList(CardSearchModel? model); + CardViewModel? ReadElement(CardSearchModel model); + bool Create(CardBindingModel model); + bool Update(CardBindingModel model); + bool Delete(CardBindingModel model); + bool ConnectCardDrink(int cardId, int drinkId); + } +} diff --git a/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IComponentLogic.cs b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IComponentLogic.cs new file mode 100644 index 0000000..dc5c8df --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IComponentLogic.cs @@ -0,0 +1,19 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; + +namespace DiningRoomContracts.BusinessLogicContracts +{ + public interface IComponentLogic + { + List? ReadList(ComponentSearchModel? Model); + + ComponentViewModel? ReadElement(ComponentSearchModel Model); + + bool Create(ComponentBindingModel Model); + + bool Update(ComponentBindingModel Model); + + bool Delete(ComponentBindingModel Model); + } +} diff --git a/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IDrinkLogic.cs b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IDrinkLogic.cs new file mode 100644 index 0000000..0fdb4db --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IDrinkLogic.cs @@ -0,0 +1,19 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; + +namespace DiningRoomContracts.BusinessLogicContracts +{ + public interface IDrinkLogic + { + List? ReadList(DrinkSearchModel? Model); + + DrinkViewModel? ReadElement(DrinkSearchModel Model); + + bool Create(DrinkBindingModel Model); + + bool Update(DrinkBindingModel Model); + + bool Delete(DrinkBindingModel Model); + } +} diff --git a/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IOrderLogic.cs b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IOrderLogic.cs new file mode 100644 index 0000000..431978e --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IOrderLogic.cs @@ -0,0 +1,23 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.BusinessLogicContracts +{ + public interface IOrderLogic + { + List? ReadList(OrderSearchModel? model); + OrderViewModel? ReadElement(OrderSearchModel model); + bool Create(OrderBindingModel model); + bool Update(OrderBindingModel model); + bool Delete(OrderBindingModel model); + bool TakeOrderInWork(OrderBindingModel model); + bool FinishOrder(OrderBindingModel model); + bool DeliveryOrder(OrderBindingModel model); + } +} diff --git a/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IProductLogic.cs b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IProductLogic.cs new file mode 100644 index 0000000..aa634ad --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IProductLogic.cs @@ -0,0 +1,19 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; + +namespace DiningRoomContracts.BusinessLogicContracts +{ + public interface IProductLogic + { + List? ReadList(ProductSearchModel? Model); + + ProductViewModel? ReadElement(ProductSearchModel Model); + + bool Create(ProductBindingModel Model); + + bool Update(ProductBindingModel Model); + + bool Delete(ProductBindingModel Model); + } +} diff --git a/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IUserLogic.cs b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IUserLogic.cs new file mode 100644 index 0000000..9dce773 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/BusinessLogicContracts/IUserLogic.cs @@ -0,0 +1,20 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.BusinessLogicContracts +{ + public interface IUserLogic + { + List? ReadList(UserSearchModel? model); + UserViewModel? ReadElement(UserSearchModel model); + bool Create(UserBindingModel model); + bool Update(UserBindingModel model); + bool Delete(UserBindingModel model); + } +} diff --git a/DiningRoom/DiningRoomContracts/DiningRoomContracts.csproj b/DiningRoom/DiningRoomContracts/DiningRoomContracts.csproj index 132c02c..3c17e13 100644 --- a/DiningRoom/DiningRoomContracts/DiningRoomContracts.csproj +++ b/DiningRoom/DiningRoomContracts/DiningRoomContracts.csproj @@ -6,4 +6,8 @@ enable + + + + diff --git a/DiningRoom/DiningRoomContracts/SearchModels/CardSearchModel.cs b/DiningRoom/DiningRoomContracts/SearchModels/CardSearchModel.cs new file mode 100644 index 0000000..c1d6a4c --- /dev/null +++ b/DiningRoom/DiningRoomContracts/SearchModels/CardSearchModel.cs @@ -0,0 +1,11 @@ +namespace DiningRoomContracts.SearchModels +{ + public class CardSearchModel + { + public int? Id { get; set; } + + public int? UserId { get; set; } + + public string? Cardname { get; set; } + } +} diff --git a/DiningRoom/DiningRoomContracts/SearchModels/ComponentSearchModel.cs b/DiningRoom/DiningRoomContracts/SearchModels/ComponentSearchModel.cs new file mode 100644 index 0000000..2404884 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/SearchModels/ComponentSearchModel.cs @@ -0,0 +1,9 @@ +namespace DiningRoomContracts.SearchModels +{ + public class ComponentSearchModel + { + public int? Id { get; set; } + + public int? UserId { get; set; } + } +} diff --git a/DiningRoom/DiningRoomContracts/SearchModels/DrinkSearchModel.cs b/DiningRoom/DiningRoomContracts/SearchModels/DrinkSearchModel.cs new file mode 100644 index 0000000..ce3247e --- /dev/null +++ b/DiningRoom/DiningRoomContracts/SearchModels/DrinkSearchModel.cs @@ -0,0 +1,11 @@ +namespace DiningRoomContracts.SearchModels +{ + public class DrinkSearchModel + { + public int? Id { get; set; } + + public int? UserId { get; set; } + + public string? DrinkName { get; set; } + } +} diff --git a/DiningRoom/DiningRoomContracts/SearchModels/OrderSearchModel.cs b/DiningRoom/DiningRoomContracts/SearchModels/OrderSearchModel.cs new file mode 100644 index 0000000..4d60ccc --- /dev/null +++ b/DiningRoom/DiningRoomContracts/SearchModels/OrderSearchModel.cs @@ -0,0 +1,25 @@ +using DiningRoomDataModels.Enums; +using DiningRoomDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.SearchModels +{ + public class OrderSearchModel + { + public int? Id { get; set; } + public int? UserId { get; set; } + + public DateTime? DateFrom { get; set; } + public DateTime? DateTo { get; set; } + + public OrderStatus? Status { get; set; } + public Dictionary ProductOrder { get; set; } = new(); + public Dictionary DrinkOrder { get; set; } = new(); + + public double? Sum { get; set; } + } +} diff --git a/DiningRoom/DiningRoomContracts/SearchModels/ProductSearchModel.cs b/DiningRoom/DiningRoomContracts/SearchModels/ProductSearchModel.cs new file mode 100644 index 0000000..19837f2 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/SearchModels/ProductSearchModel.cs @@ -0,0 +1,11 @@ +namespace DiningRoomContracts.SearchModels +{ + public class ProductSearchModel + { + public int? Id { get; set; } + + public int? UserId { get; set; } + + public string? ProductName { get; set; } + } +} diff --git a/DiningRoom/DiningRoomContracts/SearchModels/UserSearchModel.cs b/DiningRoom/DiningRoomContracts/SearchModels/UserSearchModel.cs new file mode 100644 index 0000000..19e7db1 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/SearchModels/UserSearchModel.cs @@ -0,0 +1,20 @@ +using DiningRoomDataModels.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.SearchModels +{ + public class UserSearchModel + { + public int? Id { get; set; } + public string? Login { get; set; } + + public string Password { get; set; } + + public string? Email { get; set; } + public UserRole? Role { get; set; } + } +} diff --git a/DiningRoom/DiningRoomContracts/StorageContracts/ICardStorage.cs b/DiningRoom/DiningRoomContracts/StorageContracts/ICardStorage.cs new file mode 100644 index 0000000..be6658d --- /dev/null +++ b/DiningRoom/DiningRoomContracts/StorageContracts/ICardStorage.cs @@ -0,0 +1,21 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; + +namespace DiningRoomContracts.StorageContracts +{ + public interface ICardStorage + { + List GetFullList(); + + List GetFilteredList(CardSearchModel Model); + + CardViewModel? GetElement(CardSearchModel Model); + + CardViewModel? Insert(CardBindingModel Model); + + CardViewModel? Update(CardBindingModel Model); + + CardViewModel? Delete(CardBindingModel Model); + } +} diff --git a/DiningRoom/DiningRoomContracts/StorageContracts/IComponentStorage.cs b/DiningRoom/DiningRoomContracts/StorageContracts/IComponentStorage.cs new file mode 100644 index 0000000..7df7126 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/StorageContracts/IComponentStorage.cs @@ -0,0 +1,21 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; + +namespace DiningRoomContracts.StorageContracts +{ + public interface IComponentStorage + { + List GetFullList(); + + List GetFilteredList(ComponentSearchModel Model); + + ComponentViewModel? GetElement(ComponentSearchModel Model); + + ComponentViewModel? Insert(ComponentBindingModel Model); + + ComponentViewModel? Update(ComponentBindingModel Model); + + ComponentViewModel? Delete(ComponentBindingModel Model); + } +} diff --git a/DiningRoom/DiningRoomContracts/StorageContracts/IDrinkStorage.cs b/DiningRoom/DiningRoomContracts/StorageContracts/IDrinkStorage.cs new file mode 100644 index 0000000..d955ae9 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/StorageContracts/IDrinkStorage.cs @@ -0,0 +1,21 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; + +namespace DiningRoomContracts.StorageContracts +{ + public interface IDrinkStorage + { + List GetFullList(); + + List GetFilteredList(DrinkSearchModel Model); + + DrinkViewModel? GetElement(DrinkSearchModel Model); + + DrinkViewModel? Insert(DrinkBindingModel Model); + + DrinkViewModel? Update(DrinkBindingModel Model); + + DrinkViewModel? Delete(DrinkBindingModel Model); + } +} diff --git a/DiningRoom/DiningRoomContracts/StorageContracts/IOrderStorage.cs b/DiningRoom/DiningRoomContracts/StorageContracts/IOrderStorage.cs new file mode 100644 index 0000000..0643573 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/StorageContracts/IOrderStorage.cs @@ -0,0 +1,21 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.StorageContracts +{ + public interface IOrderStorage + { + List GetFullList(); + List GetFilteredList(OrderSearchModel model); + OrderViewModel? GetElement(OrderSearchModel model); + OrderViewModel? Insert(OrderBindingModel model); + OrderViewModel? Update(OrderBindingModel model); + OrderViewModel? Delete(OrderBindingModel model); + } +} diff --git a/DiningRoom/DiningRoomContracts/StorageContracts/IProductStorage.cs b/DiningRoom/DiningRoomContracts/StorageContracts/IProductStorage.cs new file mode 100644 index 0000000..8741ee7 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/StorageContracts/IProductStorage.cs @@ -0,0 +1,21 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; + +namespace DiningRoomContracts.StorageContracts +{ + public interface IProductStorage + { + List GetFullList(); + + List GetFilteredList(ProductSearchModel Model); + + ProductViewModel? GetElement(ProductSearchModel Model); + + ProductViewModel? Insert(ProductBindingModel Model); + + ProductViewModel? Update(ProductBindingModel Model); + + ProductViewModel? Delete(ProductBindingModel Model); + } +} diff --git a/DiningRoom/DiningRoomContracts/StorageContracts/IUserStorage.cs b/DiningRoom/DiningRoomContracts/StorageContracts/IUserStorage.cs new file mode 100644 index 0000000..dca9103 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/StorageContracts/IUserStorage.cs @@ -0,0 +1,21 @@ +using DiningRoomContracts.BindingModels; +using DiningRoomContracts.SearchModels; +using DiningRoomContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.StorageContracts +{ + public interface IUserStorage + { + List GetFullList(); + List GetFilteredList(UserSearchModel model); + UserViewModel? GetElement(UserSearchModel model); + UserViewModel? Insert(UserBindingModel model); + UserViewModel? Update(UserBindingModel model); + UserViewModel? Delete(UserBindingModel model); + } +} diff --git a/DiningRoom/DiningRoomContracts/ViewModels/CardViewModel.cs b/DiningRoom/DiningRoomContracts/ViewModels/CardViewModel.cs new file mode 100644 index 0000000..3803991 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/ViewModels/CardViewModel.cs @@ -0,0 +1,17 @@ +using DiningRoomDataModels.Models; +using System.ComponentModel; + +namespace DiningRoomContracts.ViewModels +{ + public class CardViewModel : ICardModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + + [DisplayName("Название карты")] + public string CardName { get; set; } = string.Empty; + public Dictionary DrinkCard { get; set; } = new(); + } +} diff --git a/DiningRoom/DiningRoomContracts/ViewModels/ComponentViewModel.cs b/DiningRoom/DiningRoomContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..acd82d1 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,21 @@ +using DiningRoomDataModels.Models; +using System.ComponentModel; + +namespace DiningRoomContracts.ViewModels +{ + public class ComponentViewModel : IComponentModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + + [DisplayName("Название продукта")] + public string ComponentName { get; set; } = string.Empty; + [DisplayName("Единица измерения")] + public string Unit { get; set; } = string.Empty; + + [DisplayName("Стоимость")] + public double Cost { get; set; } + } +} diff --git a/DiningRoom/DiningRoomContracts/ViewModels/DrinkViewModel.cs b/DiningRoom/DiningRoomContracts/ViewModels/DrinkViewModel.cs new file mode 100644 index 0000000..e8f0839 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/ViewModels/DrinkViewModel.cs @@ -0,0 +1,19 @@ +using DiningRoomDataModels.Models; +using System.ComponentModel; + +namespace DiningRoomContracts.ViewModels +{ + public class DrinkViewModel : IDrinkModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + [DisplayName("Название товара")] + public string DrinkName { get; set; } = string.Empty; + + [DisplayName("Стоимость")] + public double Cost { get; set; } + public Dictionary DrinkComponents { get; set; } = new(); + } +} diff --git a/DiningRoom/DiningRoomContracts/ViewModels/OrderViewModel.cs b/DiningRoom/DiningRoomContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..26834b7 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,29 @@ +using DiningRoomDataModels.Enums; +using DiningRoomDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.ViewModels +{ + public class OrderViewModel : IOrderModel + { + [DisplayName("Номер")] + public int Id { get; set; } + + public int UserId { get; set; } + [DisplayName("Дата Создания")] + public DateTime DateCreate { get; set; } = DateTime.Now; + public Dictionary ProductOrder { get; set; } = new(); + public Dictionary DrinkOrder { get; set; } = new(); + [DisplayName("Статус")] + public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; + + [DisplayName("Стоимость")] + public double Sum { get; set; } + + } +} diff --git a/DiningRoom/DiningRoomContracts/ViewModels/ProductViewModel.cs b/DiningRoom/DiningRoomContracts/ViewModels/ProductViewModel.cs new file mode 100644 index 0000000..3e38f67 --- /dev/null +++ b/DiningRoom/DiningRoomContracts/ViewModels/ProductViewModel.cs @@ -0,0 +1,19 @@ +using DiningRoomDataModels.Models; +using System.ComponentModel; + +namespace DiningRoomContracts.ViewModels +{ + public class ProductViewModel : IProductModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + [DisplayName("Название товара")] + public string ProductName { get; set; } = string.Empty; + + [DisplayName("Стоимость")] + public double Cost { get; set; } + public Dictionary ProductComponents { get; set; } = new(); + } +} diff --git a/DiningRoom/DiningRoomContracts/ViewModels/UserViewModel.cs b/DiningRoom/DiningRoomContracts/ViewModels/UserViewModel.cs new file mode 100644 index 0000000..c5b4b8e --- /dev/null +++ b/DiningRoom/DiningRoomContracts/ViewModels/UserViewModel.cs @@ -0,0 +1,27 @@ +using DiningRoomDataModels.Enums; +using DiningRoomDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiningRoomContracts.ViewModels +{ + public class UserViewModel : IUserModel + { + public int Id { get; set; } + + + [DisplayName("Логин")] + public string Login { get; set; } = string.Empty; + + [DisplayName("Пароль")] + public string Password { get; set; } = string.Empty; + + [DisplayName("Почта")] + public string Email { get; set; } = string.Empty; + + } +} diff --git a/DiningRoom/DiningRoomDataModels/Models/IComponentModel.cs b/DiningRoom/DiningRoomDataModels/Models/IComponentModel.cs index 5b5e083..3bd7608 100644 --- a/DiningRoom/DiningRoomDataModels/Models/IComponentModel.cs +++ b/DiningRoom/DiningRoomDataModels/Models/IComponentModel.cs @@ -18,10 +18,6 @@ /// Единица измерения /// string Unit { get; } - /// - /// Количество - /// - int count { get; } /// /// Цена продукта diff --git a/DiningRoom/DiningRoomDataModels/Models/IDrinkModel.cs b/DiningRoom/DiningRoomDataModels/Models/IDrinkModel.cs index 9b48a0e..6d1ec74 100644 --- a/DiningRoom/DiningRoomDataModels/Models/IDrinkModel.cs +++ b/DiningRoom/DiningRoomDataModels/Models/IDrinkModel.cs @@ -23,6 +23,6 @@ /// /// Список комплектующих /// - Dictionary ProductComponents { get; } + Dictionary DrinkComponents { get; } } } diff --git a/DiningRoom/DiningRoomDataModels/Models/IProductModel.cs b/DiningRoom/DiningRoomDataModels/Models/IProductModel.cs index 749a739..043224b 100644 --- a/DiningRoom/DiningRoomDataModels/Models/IProductModel.cs +++ b/DiningRoom/DiningRoomDataModels/Models/IProductModel.cs @@ -21,7 +21,7 @@ double Cost { get; } /// - /// Список комплектующих + /// Список продуктов /// Dictionary ProductComponents { get; } }