Добавлена библиотека SushiBarContracts
This commit is contained in:
parent
62aa143ea2
commit
09c564caae
@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBar", "SushiBar.csproj
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarDataModels", "..\SushiBarDataModels\SushiBarDataModels.csproj", "{98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarContracts", "..\SushiBarContracts\SushiBarContracts.csproj", "{0C8B928F-ACD2-4196-8F2B-5190914911D8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0C8B928F-ACD2-4196-8F2B-5190914911D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0C8B928F-ACD2-4196-8F2B-5190914911D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0C8B928F-ACD2-4196-8F2B-5190914911D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0C8B928F-ACD2-4196-8F2B-5190914911D8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
11
SushiBarContracts/BindingModel/ComponentBindingModel.cs
Normal file
11
SushiBarContracts/BindingModel/ComponentBindingModel.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using SushiBarDataModels.Models;
|
||||
|
||||
namespace SushiBarContracts.BindingModel
|
||||
{
|
||||
public class ComponentBindingModel : IComponentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
22
SushiBarContracts/BindingModel/OrderBindingModel.cs
Normal file
22
SushiBarContracts/BindingModel/OrderBindingModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using SushiBarDataModels;
|
||||
using SushiBarDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SushiBarContracts.BindingModel
|
||||
{
|
||||
public class OrderBindingModel : IOrderModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int SushiId { get; set; }
|
||||
public int Count { get; set; }
|
||||
public double Sum { get; set; }
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
public DateTime? DateImplement { get; set; }
|
||||
|
||||
}
|
||||
}
|
12
SushiBarContracts/BindingModel/SushiBindingModel.cs
Normal file
12
SushiBarContracts/BindingModel/SushiBindingModel.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using SushiBarDataModels.Models;
|
||||
|
||||
namespace SushiBarContracts.BindingModel
|
||||
{
|
||||
public class SushiBindingModel : ISushiModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string SushiName { get; set; } = string.Empty;
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, (IComponentModel, int)> SushiComponents { get; set; } = new();
|
||||
}
|
||||
}
|
15
SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs
Normal file
15
SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using SushiBarContracts.BindingModel;
|
||||
using SushiBarContracts.SearchModel;
|
||||
using SushiBarContracts.ViewModels;
|
||||
|
||||
namespace SushiBarContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IComponentLogic
|
||||
{
|
||||
List<ComponentViewModel>? ReadList(ComponentSearchModel? model);
|
||||
ComponentViewModel? ReadElement(ComponentSearchModel model);
|
||||
bool Create(ComponentBindingModel model);
|
||||
bool Update(ComponentBindingModel model);
|
||||
bool Delete(ComponentBindingModel model);
|
||||
}
|
||||
}
|
15
SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs
Normal file
15
SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using SushiBarContracts.BindingModel;
|
||||
using SushiBarContracts.SearchModel;
|
||||
using SushiBarContracts.ViewModels;
|
||||
|
||||
namespace SushiBarContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IOrderLogic
|
||||
{
|
||||
List<OrderViewModel>? ReadList(OrderSearchModel? model);
|
||||
bool CreateOrder(OrderBindingModel model);
|
||||
bool TakeOrderInWork(OrderBindingModel model);
|
||||
bool FinishOrder(OrderBindingModel model);
|
||||
bool DeliveryOrder(OrderBindingModel model);
|
||||
}
|
||||
}
|
16
SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs
Normal file
16
SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using SushiBarContracts.BindingModel;
|
||||
using SushiBarContracts.SearchModel;
|
||||
using SushiBarContracts.ViewModels;
|
||||
|
||||
namespace SushiBarContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ISushiLogic
|
||||
{
|
||||
List<SushiViewModel>? ReadList(SushiSearchModel? model);
|
||||
SushiViewModel? ReadElement(SushiSearchModel model);
|
||||
bool Create(SushiBindingModel model);
|
||||
bool Update(SushiBindingModel model);
|
||||
bool Delete(SushiBindingModel model);
|
||||
|
||||
}
|
||||
}
|
9
SushiBarContracts/SearchModel/ComponentSearchModel.cs
Normal file
9
SushiBarContracts/SearchModel/ComponentSearchModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
namespace SushiBarContracts.SearchModel
|
||||
{
|
||||
public class ComponentSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? ComponentName { get; set; }
|
||||
}
|
||||
}
|
13
SushiBarContracts/SearchModel/OrderSearchModel.cs
Normal file
13
SushiBarContracts/SearchModel/OrderSearchModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SushiBarContracts.SearchModel
|
||||
{
|
||||
public class OrderSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
8
SushiBarContracts/SearchModel/SushiSearchModel.cs
Normal file
8
SushiBarContracts/SearchModel/SushiSearchModel.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace SushiBarContracts.SearchModel
|
||||
{
|
||||
public class SushiSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? SushiName { get; set; }
|
||||
}
|
||||
}
|
16
SushiBarContracts/StoragesContracts/IComponentStorage.cs
Normal file
16
SushiBarContracts/StoragesContracts/IComponentStorage.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using SushiBarContracts.BindingModel;
|
||||
using SushiBarContracts.SearchModel;
|
||||
using SushiBarContracts.ViewModels;
|
||||
|
||||
namespace SushiBarContracts.StoragesContracts
|
||||
{
|
||||
public interface IComponentStorage
|
||||
{
|
||||
List<ComponentViewModel> GetFullList();
|
||||
List<ComponentViewModel> GetFilteredList(ComponentSearchModel model);
|
||||
ComponentViewModel? GetElement(ComponentSearchModel model);
|
||||
ComponentViewModel? Insert(ComponentBindingModel model);
|
||||
ComponentViewModel? Update(ComponentBindingModel model);
|
||||
ComponentViewModel? Delete(ComponentBindingModel model);
|
||||
}
|
||||
}
|
16
SushiBarContracts/StoragesContracts/IOrderStorage.cs
Normal file
16
SushiBarContracts/StoragesContracts/IOrderStorage.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using SushiBarContracts.BindingModel;
|
||||
using SushiBarContracts.SearchModel;
|
||||
using SushiBarContracts.ViewModels;
|
||||
|
||||
namespace SushiBarContracts.StoragesContracts
|
||||
{
|
||||
public interface IOrderStorage
|
||||
{
|
||||
List<OrderViewModel> GetFullList();
|
||||
List<OrderViewModel> GetFilteredList(OrderSearchModel model);
|
||||
OrderViewModel? GetElement(OrderSearchModel model);
|
||||
OrderViewModel? Insert(OrderBindingModel model);
|
||||
OrderViewModel? Update(OrderBindingModel model);
|
||||
OrderViewModel? Delete(OrderBindingModel model);
|
||||
}
|
||||
}
|
16
SushiBarContracts/StoragesContracts/ISushiStorage.cs
Normal file
16
SushiBarContracts/StoragesContracts/ISushiStorage.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using SushiBarContracts.BindingModel;
|
||||
using SushiBarContracts.SearchModel;
|
||||
using SushiBarContracts.ViewModels;
|
||||
|
||||
namespace SushiBarContracts.StoragesContracts
|
||||
{
|
||||
public interface ISushiStorage
|
||||
{
|
||||
List<SushiViewModel> GetFullList();
|
||||
List<SushiViewModel> GetFilteredList(SushiSearchModel model);
|
||||
SushiViewModel? GetElement(SushiSearchModel model);
|
||||
SushiViewModel? Insert(SushiBindingModel model);
|
||||
SushiViewModel? Update(SushiBindingModel model);
|
||||
SushiViewModel? Delete(SushiBindingModel model);
|
||||
}
|
||||
}
|
13
SushiBarContracts/SushiBarContracts.csproj
Normal file
13
SushiBarContracts/SushiBarContracts.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
18
SushiBarContracts/ViewModels/ComponentViewModel.cs
Normal file
18
SushiBarContracts/ViewModels/ComponentViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.ComponentModel;
|
||||
using SushiBarDataModels.Models;
|
||||
|
||||
namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class ComponentViewModel : IComponentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название компонента")]
|
||||
|
||||
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
[DisplayName("Цена")]
|
||||
|
||||
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
38
SushiBarContracts/ViewModels/OrderViewModel.cs
Normal file
38
SushiBarContracts/ViewModels/OrderViewModel.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System.ComponentModel;
|
||||
using SushiBarDataModels.Models;
|
||||
using SushiBarDataModels.Enums;
|
||||
using SushiBarDataModels;
|
||||
|
||||
namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
[DisplayName("Номер")]
|
||||
public int Id { get; set; }
|
||||
public int SushiId { get; set; }
|
||||
|
||||
|
||||
[DisplayName("Изделие")]
|
||||
public string SushiName { 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; }
|
||||
}
|
||||
}
|
23
SushiBarContracts/ViewModels/SushiViewModel.cs
Normal file
23
SushiBarContracts/ViewModels/SushiViewModel.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.ComponentModel;
|
||||
using SushiBarDataModels.Models;
|
||||
|
||||
namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class SushiViewModel : ISushiModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название изделия")]
|
||||
|
||||
|
||||
public string SushiName { get; set; } = string.Empty;
|
||||
[DisplayName("Цена")]
|
||||
|
||||
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, (IComponentModel, int)> SushiComponents
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user