Добавлены классы-модели сущностей в реализацию хранилища на основе списков
This commit is contained in:
parent
2093186453
commit
cdf691d078
@ -3,13 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.3.32825.248
|
VisualStudioVersion = 17.3.32825.248
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowerShop", "FlowerShop\FlowerShop.csproj", "{086CB019-AA3B-425A-87B0-26662D1F201F}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowerShop", "FlowerShop\FlowerShop.csproj", "{086CB019-AA3B-425A-87B0-26662D1F201F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowerShopDataModels", "FlowerShopDataModels\FlowerShopDataModels.csproj", "{FDC31847-CB24-4EBD-8CE5-852ED404CEAE}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowerShopDataModels", "FlowerShopDataModels\FlowerShopDataModels.csproj", "{FDC31847-CB24-4EBD-8CE5-852ED404CEAE}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowerShopContracts", "FlowerShopContracts\FlowerShopContracts.csproj", "{404B251B-7B48-4648-99B4-7E99EDB05A6C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowerShopContracts", "FlowerShopContracts\FlowerShopContracts.csproj", "{404B251B-7B48-4648-99B4-7E99EDB05A6C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowerShopBusinessLogic", "FlowerShopBusinessLogic\FlowerShopBusinessLogic.csproj", "{D8084C04-7B2B-4C8D-A63A-71A3EE1BC065}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowerShopBusinessLogic", "FlowerShopBusinessLogic\FlowerShopBusinessLogic.csproj", "{D8084C04-7B2B-4C8D-A63A-71A3EE1BC065}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowerShopListImplement", "FlowerShopListImplement\FlowerShopListImplement.csproj", "{C58840E6-D68D-476E-AB3A-EB13F1740FC8}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -33,6 +35,10 @@ Global
|
|||||||
{D8084C04-7B2B-4C8D-A63A-71A3EE1BC065}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D8084C04-7B2B-4C8D-A63A-71A3EE1BC065}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D8084C04-7B2B-4C8D-A63A-71A3EE1BC065}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D8084C04-7B2B-4C8D-A63A-71A3EE1BC065}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D8084C04-7B2B-4C8D-A63A-71A3EE1BC065}.Release|Any CPU.Build.0 = Release|Any CPU
|
{D8084C04-7B2B-4C8D-A63A-71A3EE1BC065}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C58840E6-D68D-476E-AB3A-EB13F1740FC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C58840E6-D68D-476E-AB3A-EB13F1740FC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C58840E6-D68D-476E-AB3A-EB13F1740FC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C58840E6-D68D-476E-AB3A-EB13F1740FC8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\FlowerShopContracts\FlowerShopContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\FlowerShopDataModels\FlowerShopDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
50
FlowerShop/FlowerShopListImplement/Models/Bouquet.cs
Normal file
50
FlowerShop/FlowerShopListImplement/Models/Bouquet.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using FlowerShopContracts.BindingModels;
|
||||||
|
using FlowerShopContracts.ViewModels;
|
||||||
|
using FlowerShopDataModels.Models;
|
||||||
|
|
||||||
|
namespace FlowerShopListImplement.Models
|
||||||
|
{
|
||||||
|
public class Bouquet : IBouquetModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public string BouquetName { get; private set; } = string.Empty;
|
||||||
|
public double Price { get; private set; }
|
||||||
|
public Dictionary<int, (IComponentModel, int)> BouquetComponents { get; private set; } = new Dictionary<int, (IComponentModel, int)>();
|
||||||
|
|
||||||
|
public static Bouquet? Create(BouquetBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Bouquet()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
BouquetName = model.BouquetName,
|
||||||
|
Price = model.Price,
|
||||||
|
BouquetComponents = model.BouquetComponents
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(BouquetBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BouquetName = model.BouquetName;
|
||||||
|
Price = model.Price;
|
||||||
|
BouquetComponents = model.BouquetComponents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BouquetViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
BouquetName = BouquetName,
|
||||||
|
Price = Price,
|
||||||
|
BouquetComponents = BouquetComponents
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
47
FlowerShop/FlowerShopListImplement/Models/Component.cs
Normal file
47
FlowerShop/FlowerShopListImplement/Models/Component.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using FlowerShopContracts.BindingModels;
|
||||||
|
using FlowerShopContracts.ViewModels;
|
||||||
|
using FlowerShopDataModels.Models;
|
||||||
|
|
||||||
|
|
||||||
|
namespace FlowerShopListImplement.Models
|
||||||
|
{
|
||||||
|
public class Component : IComponentModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public string ComponentName { get; private set; } = string.Empty;
|
||||||
|
public double Cost { get; set; }
|
||||||
|
|
||||||
|
public static Component? Create(ComponentBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Component()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ComponentName = model.ComponentName,
|
||||||
|
Cost = model.Cost
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(ComponentBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ComponentName = model.ComponentName;
|
||||||
|
Cost = model.Cost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ComponentViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ComponentName = ComponentName,
|
||||||
|
Cost = Cost
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
64
FlowerShop/FlowerShopListImplement/Models/Order.cs
Normal file
64
FlowerShop/FlowerShopListImplement/Models/Order.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
using FlowerShopContracts.BindingModels;
|
||||||
|
using FlowerShopContracts.ViewModels;
|
||||||
|
using FlowerShopDataModels.Enums;
|
||||||
|
using FlowerShopDataModels.Models;
|
||||||
|
|
||||||
|
namespace FlowerShopListImplement.Models
|
||||||
|
{
|
||||||
|
public class Order : IOrderModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public int BouquetId { get; private set; }
|
||||||
|
public int Count { get; private set; }
|
||||||
|
public double Sum { get; private set; }
|
||||||
|
public OrderStatus Status { get; private set; }
|
||||||
|
public DateTime DateCreate { get; private set; }
|
||||||
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
|
||||||
|
public static Order? Create(OrderBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Order()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
BouquetId = model.BouquetId,
|
||||||
|
Count = model.Count,
|
||||||
|
Sum = model.Sum,
|
||||||
|
Status = model.Status,
|
||||||
|
DateCreate = model.DateCreate,
|
||||||
|
DateImplement = model.DateImplement
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(OrderBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Id = model.Id;
|
||||||
|
BouquetId = model.BouquetId;
|
||||||
|
Count = model.Count;
|
||||||
|
Sum = model.Sum;
|
||||||
|
Status = model.Status;
|
||||||
|
DateCreate = model.DateCreate;
|
||||||
|
DateImplement = model.DateImplement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
BouquetId = BouquetId,
|
||||||
|
Count = Count,
|
||||||
|
Sum = Sum,
|
||||||
|
Status = Status,
|
||||||
|
DateCreate = DateCreate,
|
||||||
|
DateImplement = DateImplement
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user