Добавлена библиотека SushiBarContracts

This commit is contained in:
ekallin 2024-02-25 19:29:35 +04:00
parent 62aa143ea2
commit 09c564caae
17 changed files with 267 additions and 0 deletions

View File

@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBar", "SushiBar.csproj
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarDataModels", "..\SushiBarDataModels\SushiBarDataModels.csproj", "{98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarDataModels", "..\SushiBarDataModels\SushiBarDataModels.csproj", "{98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarContracts", "..\SushiBarContracts\SushiBarContracts.csproj", "{0C8B928F-ACD2-4196-8F2B-5190914911D8}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU 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}.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.ActiveCfg = Release|Any CPU
{98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View 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; }
}
}

View 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; }
}
}

View 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();
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View File

@ -0,0 +1,9 @@

namespace SushiBarContracts.SearchModel
{
public class ComponentSearchModel
{
public int? Id { get; set; }
public string? ComponentName { get; set; }
}
}

View 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; }
}
}

View File

@ -0,0 +1,8 @@
namespace SushiBarContracts.SearchModel
{
public class SushiSearchModel
{
public int? Id { get; set; }
public string? SushiName { get; set; }
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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>

View 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; }
}
}

View 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; }
}
}

View 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();
}
}