Add business logic
This commit is contained in:
parent
cd13ac1206
commit
30ba4972f9
@ -9,7 +9,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDataModels", "Sushi
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDatabaseImplement", "SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj", "{135C846B-59EC-4803-B07C-8991C60C57D6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{25C0DCD8-6A40-42C5-8459-00F6F085A8C6}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{25C0DCD8-6A40-42C5-8459-00F6F085A8C6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarBusinessLogic", "SushiBarBusinessLogic\SushiBarBusinessLogic.csproj", "{9C95CAA4-50E8-42DC-B73E-0DB60EDC7A8A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -33,6 +35,10 @@ Global
|
||||
{25C0DCD8-6A40-42C5-8459-00F6F085A8C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{25C0DCD8-6A40-42C5-8459-00F6F085A8C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25C0DCD8-6A40-42C5-8459-00F6F085A8C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9C95CAA4-50E8-42DC-B73E-0DB60EDC7A8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9C95CAA4-50E8-42DC-B73E-0DB60EDC7A8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9C95CAA4-50E8-42DC-B73E-0DB60EDC7A8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9C95CAA4-50E8-42DC-B73E-0DB60EDC7A8A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
51
SushiBarBusinessLogic/ChequeLogic.cs
Normal file
51
SushiBarBusinessLogic/ChequeLogic.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using SushiBarContracts.BindingModels;
|
||||
using SushiBarContracts.SearchModels;
|
||||
using SushiBarContracts.ViewModels;
|
||||
using SushiBarDatabaseImplement.Storages;
|
||||
|
||||
namespace SushiBarBusinessLogic
|
||||
{
|
||||
public class ChequeLogic
|
||||
{
|
||||
private readonly ChequeStorage _chequeStorage;
|
||||
|
||||
public ChequeLogic(ChequeStorage ChequeStorage)
|
||||
{
|
||||
_chequeStorage = ChequeStorage;
|
||||
}
|
||||
|
||||
public List<ChequeViewModel>? ReadList(ChequeSearchModel? Model)
|
||||
{
|
||||
var List = Model is null ? _chequeStorage.GetFullList() : _chequeStorage.GetFilteredList(Model);
|
||||
|
||||
if (List is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return List;
|
||||
}
|
||||
|
||||
public ChequeViewModel? ReadElement(ChequeSearchModel? Model)
|
||||
{
|
||||
if (Model is null)
|
||||
throw new ArgumentNullException(nameof(Model));
|
||||
|
||||
var Element = _chequeStorage.GetElement(Model);
|
||||
|
||||
if (Element is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Element;
|
||||
}
|
||||
|
||||
public bool CreateCheque(ChequeBindingModel Model)
|
||||
{
|
||||
if (_chequeStorage.Insert(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
69
SushiBarBusinessLogic/CookLogic.cs
Normal file
69
SushiBarBusinessLogic/CookLogic.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using SushiBarContracts.BindingModels;
|
||||
using SushiBarContracts.SearchModels;
|
||||
using SushiBarContracts.ViewModels;
|
||||
using SushiBarDatabaseImplement.Storages;
|
||||
|
||||
namespace SushiBarBusinessLogic
|
||||
{
|
||||
public class CookLogic
|
||||
{
|
||||
private readonly CookStorage _cookStorage;
|
||||
|
||||
public CookLogic(CookStorage CookStorage)
|
||||
{
|
||||
_cookStorage = CookStorage;
|
||||
}
|
||||
|
||||
public List<CookViewModel>? ReadList(CookSearchModel? Model)
|
||||
{
|
||||
var List = Model is null ? _cookStorage.GetFullList() : _cookStorage.GetFilteredList(Model);
|
||||
|
||||
if (List is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return List;
|
||||
}
|
||||
|
||||
public CookViewModel? ReadElement(CookSearchModel? Model)
|
||||
{
|
||||
if (Model is null)
|
||||
throw new ArgumentNullException(nameof(Model));
|
||||
|
||||
var Element = _cookStorage.GetElement(Model);
|
||||
|
||||
if (Element is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Element;
|
||||
}
|
||||
|
||||
public bool Create(CookBindingModel Model)
|
||||
{
|
||||
if (_cookStorage.Insert(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(CookBindingModel Model)
|
||||
{
|
||||
if (_cookStorage.Update(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(CookBindingModel Model)
|
||||
{
|
||||
if (_cookStorage.Delete(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
69
SushiBarBusinessLogic/CustomerLogic.cs
Normal file
69
SushiBarBusinessLogic/CustomerLogic.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using SushiBarContracts.BindingModels;
|
||||
using SushiBarContracts.SearchModels;
|
||||
using SushiBarContracts.ViewModels;
|
||||
using SushiBarDatabaseImplement.Storages;
|
||||
|
||||
namespace SushiBarBusinessLogic
|
||||
{
|
||||
public class CustomerLogic
|
||||
{
|
||||
private readonly CustomerStorage _customerStorage;
|
||||
|
||||
public CustomerLogic(CustomerStorage CustomerStorage)
|
||||
{
|
||||
_customerStorage = CustomerStorage;
|
||||
}
|
||||
|
||||
public List<CustomerViewModel>? ReadList(CustomerSearchModel? Model)
|
||||
{
|
||||
var List = Model is null ? _customerStorage.GetFullList() : _customerStorage.GetFilteredList(Model);
|
||||
|
||||
if (List is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return List;
|
||||
}
|
||||
|
||||
public CustomerViewModel? ReadElement(CustomerSearchModel? Model)
|
||||
{
|
||||
if (Model is null)
|
||||
throw new ArgumentNullException(nameof(Model));
|
||||
|
||||
var Element = _customerStorage.GetElement(Model);
|
||||
|
||||
if (Element is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Element;
|
||||
}
|
||||
|
||||
public bool Create(CustomerBindingModel Model)
|
||||
{
|
||||
if (_customerStorage.Insert(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(CustomerBindingModel Model)
|
||||
{
|
||||
if (_customerStorage.Update(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(CustomerBindingModel Model)
|
||||
{
|
||||
if (_customerStorage.Delete(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
69
SushiBarBusinessLogic/DishLogic.cs
Normal file
69
SushiBarBusinessLogic/DishLogic.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using SushiBarContracts.BindingModels;
|
||||
using SushiBarContracts.SearchModels;
|
||||
using SushiBarContracts.ViewModels;
|
||||
using SushiBarDatabaseImplement.Storages;
|
||||
|
||||
namespace SushiBarBusinessLogic
|
||||
{
|
||||
public class DishLogic
|
||||
{
|
||||
private readonly DishStorage _dishStorage;
|
||||
|
||||
public DishLogic(DishStorage DishStorage)
|
||||
{
|
||||
_dishStorage = DishStorage;
|
||||
}
|
||||
|
||||
public List<DishViewModel>? ReadList(DishSearchModel? Model)
|
||||
{
|
||||
var List = Model is null ? _dishStorage.GetFullList() : _dishStorage.GetFilteredList(Model);
|
||||
|
||||
if (List is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return List;
|
||||
}
|
||||
|
||||
public DishViewModel? ReadElement(DishSearchModel? Model)
|
||||
{
|
||||
if (Model is null)
|
||||
throw new ArgumentNullException(nameof(Model));
|
||||
|
||||
var Element = _dishStorage.GetElement(Model);
|
||||
|
||||
if (Element is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Element;
|
||||
}
|
||||
|
||||
public bool Create(DishBindingModel Model)
|
||||
{
|
||||
if (_dishStorage.Insert(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(DishBindingModel Model)
|
||||
{
|
||||
if (_dishStorage.Update(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(DishBindingModel Model)
|
||||
{
|
||||
if (_dishStorage.Delete(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
69
SushiBarBusinessLogic/IngredientLogic.cs
Normal file
69
SushiBarBusinessLogic/IngredientLogic.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using SushiBarContracts.BindingModels;
|
||||
using SushiBarContracts.SearchModels;
|
||||
using SushiBarContracts.ViewModels;
|
||||
using SushiBarDatabaseImplement.Storages;
|
||||
|
||||
namespace SushiBarBusinessLogic
|
||||
{
|
||||
public class IngredientLogic
|
||||
{
|
||||
private readonly IngredientStorage _ingredientStorage;
|
||||
|
||||
public IngredientLogic(IngredientStorage IngredientStorage)
|
||||
{
|
||||
_ingredientStorage = IngredientStorage;
|
||||
}
|
||||
|
||||
public List<IngredientViewModel>? ReadList(IngredientSearchModel? Model)
|
||||
{
|
||||
var List = Model is null ? _ingredientStorage.GetFullList() : _ingredientStorage.GetFilteredList(Model);
|
||||
|
||||
if (List is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return List;
|
||||
}
|
||||
|
||||
public IngredientViewModel? ReadElement(IngredientSearchModel? Model)
|
||||
{
|
||||
if (Model is null)
|
||||
throw new ArgumentNullException(nameof(Model));
|
||||
|
||||
var Element = _ingredientStorage.GetElement(Model);
|
||||
|
||||
if (Element is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Element;
|
||||
}
|
||||
|
||||
public bool Create(IngredientBindingModel Model)
|
||||
{
|
||||
if (_ingredientStorage.Insert(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(IngredientBindingModel Model)
|
||||
{
|
||||
if (_ingredientStorage.Update(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(IngredientBindingModel Model)
|
||||
{
|
||||
if (_ingredientStorage.Delete(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
69
SushiBarBusinessLogic/PromotionLogic.cs
Normal file
69
SushiBarBusinessLogic/PromotionLogic.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using SushiBarContracts.BindingModels;
|
||||
using SushiBarContracts.SearchModels;
|
||||
using SushiBarContracts.ViewModels;
|
||||
using SushiBarDatabaseImplement.Storages;
|
||||
|
||||
namespace SushiBarBusinessLogic
|
||||
{
|
||||
public class PromotionLogic
|
||||
{
|
||||
private readonly PromotionStorage _promotionStorage;
|
||||
|
||||
public PromotionLogic(PromotionStorage PromotionStorage)
|
||||
{
|
||||
_promotionStorage = PromotionStorage;
|
||||
}
|
||||
|
||||
public List<PromotionViewModel>? ReadList(PromotionSearchModel? Model)
|
||||
{
|
||||
var List = Model is null ? _promotionStorage.GetFullList() : _promotionStorage.GetFilteredList(Model);
|
||||
|
||||
if (List is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return List;
|
||||
}
|
||||
|
||||
public PromotionViewModel? ReadElement(PromotionSearchModel? Model)
|
||||
{
|
||||
if (Model is null)
|
||||
throw new ArgumentNullException(nameof(Model));
|
||||
|
||||
var Element = _promotionStorage.GetElement(Model);
|
||||
|
||||
if (Element is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Element;
|
||||
}
|
||||
|
||||
public bool Create(PromotionBindingModel Model)
|
||||
{
|
||||
if (_promotionStorage.Insert(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(PromotionBindingModel Model)
|
||||
{
|
||||
if (_promotionStorage.Update(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(PromotionBindingModel Model)
|
||||
{
|
||||
if (_promotionStorage.Delete(Model) is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
13
SushiBarBusinessLogic/SushiBarBusinessLogic.csproj
Normal file
13
SushiBarBusinessLogic/SushiBarBusinessLogic.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user