Создание проекта с контрактами
This commit is contained in:
parent
f5462ca1f8
commit
1d3604e5d7
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AbstractFoodOrdersDataModels\AbstractFoodOrdersDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,17 @@
|
||||
using AbstractFoodOrdersDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.BindingModels
|
||||
{
|
||||
public class ComponentBindingModel : IComponentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using AbstractFoodOrdersDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.BindingModels
|
||||
{
|
||||
public class ProductBindingModel : IDishModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string DishName { get; set; } = string.Empty;
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, (IComponentModel, int)> DishComponents { get; set; } = new();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using AbstractFoodOrdersDataModels.Enums;
|
||||
using AbstractFoodOrdersDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.BindingModels
|
||||
{
|
||||
public class OrderBindingModel : IOrderModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ProductId { 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; }
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using AbstractFoodOrdersContracts.BindingModels;
|
||||
using AbstractFoodOrdersContracts.SearchModels;
|
||||
using AbstractFoodOrdersContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.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);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using AbstractFoodOrdersContracts.BindingModels;
|
||||
using AbstractFoodOrdersContracts.ViewModels;
|
||||
using AbstractFoodOrdersContracts.SearchModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IDishLogic
|
||||
{
|
||||
List<DishViewModel>? ReadList(DishSearchModel? model);
|
||||
DishViewModel? ReadElement(DishSearchModel model);
|
||||
bool Create(ProductBindingModel model);
|
||||
bool Update(ProductBindingModel model);
|
||||
bool Delete(ProductBindingModel model);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using AbstractFoodOrdersContracts.BindingModels;
|
||||
using AbstractFoodOrdersContracts.SearchModels;
|
||||
using AbstractFoodOrdersContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.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);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.SearchModels
|
||||
{
|
||||
public class ComponentSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? ComponentName { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.SearchModels
|
||||
{
|
||||
public class DishSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? DishName { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.SearchModels
|
||||
{
|
||||
public class OrderSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using AbstractFoodOrdersContracts.BindingModels;
|
||||
using AbstractFoodOrdersContracts.SearchModels;
|
||||
using AbstractFoodOrdersContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.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);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using AbstractFoodOrdersContracts.BindingModels;
|
||||
using AbstractFoodOrdersContracts.SearchModels;
|
||||
using AbstractFoodOrdersContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.StoragesContracts
|
||||
{
|
||||
public interface IDishStorage
|
||||
{
|
||||
List<DishViewModel> GetFullList();
|
||||
List<DishViewModel> GetFilteredList(DishSearchModel model);
|
||||
DishViewModel? GetElement(DishSearchModel model);
|
||||
DishViewModel? Insert(ProductBindingModel model);
|
||||
DishViewModel? Update(ProductBindingModel model);
|
||||
DishViewModel? Delete(ProductBindingModel model);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using AbstractFoodOrdersContracts.BindingModels;
|
||||
using AbstractFoodOrdersContracts.SearchModels;
|
||||
using AbstractFoodOrdersContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.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);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using AbstractFoodOrdersDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.ViewModels
|
||||
{
|
||||
public class ComponentViewModel : IComponentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название компонента")]
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
[DisplayName("Цена")]
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using AbstractFoodOrdersDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.ViewModels
|
||||
{
|
||||
public class DishViewModel : IDishModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название изделия")]
|
||||
public string DishName { get; set; } = string.Empty;
|
||||
[DisplayName("Цена")]
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, (IComponentModel, int)> DishComponents { get; set; } = new();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
using AbstractFoodOrdersDataModels.Enums;
|
||||
using AbstractFoodOrdersDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersContracts.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; }
|
||||
}
|
||||
}
|
@ -6,10 +6,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractFoodOrdersDataModels.Models
|
||||
{
|
||||
public interface IProductModel : IId
|
||||
public interface IDishModel : IId
|
||||
{
|
||||
string ProductName { get; }
|
||||
string DishName { get; }
|
||||
double Price { get; }
|
||||
Dictionary<int, (IComponentModel, int)> ProductComponents { get; }
|
||||
Dictionary<int, (IComponentModel, int)> DishComponents { get; }
|
||||
}
|
||||
}
|
@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FoodOrders", "FoodOrders\Fo
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbstractFoodOrdersDataModels", "AbstractFoodOrdersDataModels\AbstractFoodOrdersDataModels.csproj", "{797093A6-6C7B-414E-874F-1BB48A6468C7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbstractFoodOrdersContracts", "AbstractFoodOrdersContracts\AbstractFoodOrdersContracts.csproj", "{926B4BA4-42BC-4D7B-AF27-01B16493D883}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{797093A6-6C7B-414E-874F-1BB48A6468C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{797093A6-6C7B-414E-874F-1BB48A6468C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{797093A6-6C7B-414E-874F-1BB48A6468C7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{926B4BA4-42BC-4D7B-AF27-01B16493D883}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{926B4BA4-42BC-4D7B-AF27-01B16493D883}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{926B4BA4-42BC-4D7B-AF27-01B16493D883}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{926B4BA4-42BC-4D7B-AF27-01B16493D883}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
Loading…
Reference in New Issue
Block a user