diff --git a/SushiBar.sln b/SushiBar.sln index ce801dd..acbfe61 100644 --- a/SushiBar.sln +++ b/SushiBar.sln @@ -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 diff --git a/SushiBarBusinessLogic/ChequeLogic.cs b/SushiBarBusinessLogic/ChequeLogic.cs new file mode 100644 index 0000000..2697dea --- /dev/null +++ b/SushiBarBusinessLogic/ChequeLogic.cs @@ -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? 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; + } + } +} diff --git a/SushiBarBusinessLogic/CookLogic.cs b/SushiBarBusinessLogic/CookLogic.cs new file mode 100644 index 0000000..1737b48 --- /dev/null +++ b/SushiBarBusinessLogic/CookLogic.cs @@ -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? 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; + } + } +} diff --git a/SushiBarBusinessLogic/CustomerLogic.cs b/SushiBarBusinessLogic/CustomerLogic.cs new file mode 100644 index 0000000..87678d4 --- /dev/null +++ b/SushiBarBusinessLogic/CustomerLogic.cs @@ -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? 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; + } + } +} diff --git a/SushiBarBusinessLogic/DishLogic.cs b/SushiBarBusinessLogic/DishLogic.cs new file mode 100644 index 0000000..b0c0268 --- /dev/null +++ b/SushiBarBusinessLogic/DishLogic.cs @@ -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? 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; + } + } +} diff --git a/SushiBarBusinessLogic/IngredientLogic.cs b/SushiBarBusinessLogic/IngredientLogic.cs new file mode 100644 index 0000000..6beae1f --- /dev/null +++ b/SushiBarBusinessLogic/IngredientLogic.cs @@ -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? 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; + } + } +} diff --git a/SushiBarBusinessLogic/PromotionLogic.cs b/SushiBarBusinessLogic/PromotionLogic.cs new file mode 100644 index 0000000..b35b34a --- /dev/null +++ b/SushiBarBusinessLogic/PromotionLogic.cs @@ -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? 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; + } + } +} diff --git a/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj b/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj new file mode 100644 index 0000000..8f29bb8 --- /dev/null +++ b/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + +