Слой контрактов

This commit is contained in:
Максим Яковлев 2024-03-26 19:41:39 +04:00
parent 2063f7c4d8
commit 28a3569fed
28 changed files with 537 additions and 0 deletions

View File

@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarView", "SushiBar\Su
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarDataModels", "SushiBarDataModels\SushiBarDataModels.csproj", "{C373ED9F-747E-47D0-9B7C-B65E062CD537}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{1FD289B3-1422-4535-8969-2F320754517B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -21,6 +23,10 @@ Global
{C373ED9F-747E-47D0-9B7C-B65E062CD537}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C373ED9F-747E-47D0-9B7C-B65E062CD537}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C373ED9F-747E-47D0-9B7C-B65E062CD537}.Release|Any CPU.Build.0 = Release|Any CPU
{1FD289B3-1422-4535-8969-2F320754517B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1FD289B3-1422-4535-8969-2F320754517B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FD289B3-1422-4535-8969-2F320754517B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1FD289B3-1422-4535-8969-2F320754517B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,19 @@
using SushiBarContracts.StoragesContracts;
using SushiBarDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.BindingModels
{
public class BuyerBindingModel : IBuyerModel
{
public int Id { get; set; }
public string BuyerName { get; set; } = string.Empty;
public DateTime? BuyerBirthDate { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using SushiBarDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.BindingModels
{
public class CookBindingModel : ICookModel
{
public int Id { get; set; }
public string CookName { get; set; } = string.Empty;
public string CookSurname { get; set; } = string.Empty;
public int Experience { get; set; }
public string PhoneNumber { get; set; } = string.Empty;
public string Passport { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,21 @@
using SushiBarDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.BindingModels
{
public class MenuBindingModel : IMenuModel
{
public int Id { get; set; }
public string FoodName { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public double Price { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using SushiBarDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.BindingModels
{
public class PlaceBindingModel : IPlaceModel
{
public int Id { get; set; }
public int PlaceNumber { get; set; }
public int CountPlaces { get; set; }
}
}

View File

@ -0,0 +1,29 @@
using SushiBarDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.BindingModels
{
public class TaskBindingModel : ITaskModel
{
public int Id { get; set; }
public DateTime TaskDate { get; set; } = DateTime.Now;
public SushiBarDataModels.Enum.TaskStatus Status { get; set; } = SushiBarDataModels.Enum.TaskStatus.Неизвестен;
public double FullPrice { get; set; }
public int PlaceId { get; set; }
public int CookId { get; set; }
public int BuyerId { get; set; }
public int MenuId { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using SushiBarContracts.BindingModels;
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.BusinessLogicContracts
{
public interface IBuyerLogic
{
List<BuyerViewModel>? ReadList(BuyerSearchModel? model);
BuyerViewModel? ReadElement(BuyerSearchModel model);
bool Create(BuyerBindingModel model);
bool Update(BuyerBindingModel model);
bool Delete(BuyerBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using SushiBarContracts.BindingModels;
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.BusinessLogicContracts
{
public interface ICookLogic
{
List<CookViewModel>? ReadList(CookSearchModel? model);
CookViewModel? ReadElement(CookSearchModel model);
bool Create(CookBindingModel model);
bool Update(CookBindingModel model);
bool Delete(CookBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using SushiBarContracts.BindingModels;
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.BusinessLogicContracts
{
public interface IMenuLogic
{
List<MenuViewModel>? ReadList(MenuSearchModel? model);
MenuViewModel? ReadElement(MenuSearchModel model);
bool Create(MenuBindingModel model);
bool Update(MenuBindingModel model);
bool Delete(MenuBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using SushiBarContracts.BindingModels;
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.BusinessLogicContracts
{
public interface IPlaceLogic
{
List<PlaceViewModel>? ReadList(PlaceSearchModel? model);
PlaceViewModel? ReadElement(PlaceSearchModel model);
bool Create(PlaceBindingModel model);
bool Update(PlaceBindingModel model);
bool Delete(PlaceBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using SushiBarContracts.BindingModels;
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.BusinessLogicContracts
{
public interface ITaskLogic
{
List<TaskViewModel>? ReadList(TaskSearchModel? model);
TaskViewModel? ReadElement(TaskSearchModel model);
bool Create(TaskBindingModel model);
bool Update(TaskBindingModel model);
bool Delete(TaskBindingModel model);
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.SearchModels
{
public class BuyerSearchModel
{
public int? Id { get; set; }
public string? BuyerName { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.SearchModels
{
public class CookSearchModel
{
public int? Id { get; set; }
public string? CookName { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.SearchModels
{
public class MenuSearchModel
{
public int? Id { get; set; }
public string? FoodName { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.SearchModels
{
public class PlaceSearchModel
{
public int? Id { get; set; }
public int? PlaceNumber { 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.SearchModels
{
public class TaskSearchModel
{
public int? Id { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.StoragesContracts
{
public interface IBuyerStorage
{
List<BuyerViewModel> GetFullList();
List<BuyerViewModel> GetFilteredList(BuyerSearchModel model);
BuyerViewModel? GetElement(BuyerSearchModel model);
BuyerViewModel? Insert(BuyerSearchModel model);
BuyerViewModel? Update(BuyerSearchModel model);
BuyerViewModel? Delete(BuyerSearchModel model);
}
}

View File

@ -0,0 +1,21 @@
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.StoragesContracts
{
public interface ICookStorage
{
List<CookViewModel> GetFullList();
List<CookViewModel> GetFilteredList(CookSearchModel model);
CookViewModel? GetElement(CookSearchModel model);
CookViewModel? Insert(CookSearchModel model);
CookViewModel? Update(CookSearchModel model);
CookViewModel? Delete(CookSearchModel model);
}
}

View File

@ -0,0 +1,21 @@
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.StoragesContracts
{
public interface IMenuStorage
{
List<MenuViewModel> GetFullList();
List<MenuViewModel> GetFilteredList(MenuSearchModel model);
MenuViewModel? GetElement(MenuSearchModel model);
MenuViewModel? Insert(MenuSearchModel model);
MenuViewModel? Update(MenuSearchModel model);
MenuViewModel? Delete(MenuSearchModel model);
}
}

View File

@ -0,0 +1,21 @@
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.StoragesContracts
{
public interface IPlaceStorage
{
List<PlaceViewModel> GetFullList();
List<PlaceViewModel> GetFilteredList(PlaceSearchModel model);
PlaceViewModel? GetElement(PlaceSearchModel model);
PlaceViewModel? Insert(PlaceSearchModel model);
PlaceViewModel? Update(PlaceSearchModel model);
PlaceViewModel? Delete(PlaceSearchModel model);
}
}

View File

@ -0,0 +1,21 @@
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.StoragesContracts
{
public interface ITaskStorage
{
List<TaskViewModel> GetFullList();
List<TaskViewModel> GetFilteredList(TaskSearchModel model);
TaskViewModel? GetElement(TaskSearchModel model);
TaskViewModel? Insert(TaskSearchModel model);
TaskViewModel? Update(TaskSearchModel model);
TaskViewModel? Delete(TaskSearchModel 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,21 @@
using SushiBarDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.ViewModels
{
public class BuyerViewModel : IBuyerModel
{
public int Id { get; set; }
[DisplayName("Имя покупателя")]
public string BuyerName { get; set; } = string.Empty;
[DisplayName("Статус")]
public DateTime? BuyerBirthDate { get; set; }
}
}

View File

@ -0,0 +1,28 @@
using SushiBarDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.ViewModels
{
public class CookViewModel : ICookModel
{
public int Id { get; set; }
[DisplayName("Имя повара")]
public string CookName { get; set; } = string.Empty;
[DisplayName("Фамилия повара")]
public string CookSurname { get; set; } = string.Empty;
public int Experience { get; set; }
public string PhoneNumber { get; set; } = string.Empty;
public string Passport { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,25 @@
using SushiBarDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.ViewModels
{
public class MenuViewModel : IMenuModel
{
public int Id { get; set; }
[DisplayName("Название блюда")]
public string FoodName { get; set; } = string.Empty;
[DisplayName("Описание блюда")]
public string Description { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using SushiBarDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.ViewModels
{
public class PlaceViewModel : IPlaceModel
{
public int Id { get; set; }
public int PlaceNumber { get; set; }
public int CountPlaces { get; set; }
}
}

View File

@ -0,0 +1,33 @@
using SushiBarDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SushiBarContracts.ViewModels
{
public class TaskViewModel : ITaskModel
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Дата заказа")]
public DateTime TaskDate { get; set; }
[DisplayName("Статус заказа")]
public SushiBarDataModels.Enum.TaskStatus Status { get; set; }
[DisplayName("Сумма")]
public double FullPrice { get; set; }
public int PlaceId { get; set; }
public int CookId { get; set; }
public int BuyerId { get; set; }
public int MenuId { get; set; }
}
}

View File

@ -10,5 +10,7 @@ namespace SushiBarDataModels.Models
int PlaceId { get; }
int CookId { get; }
int BuyerId { get; }
int MenuId { get; }
}
}