From e0da3a3c8afdce32986d04dd06d0b5e25f8e5f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B8=D1=88=D0=B5=D1=80=20=D0=91=D1=83=D1=81?= =?UTF-8?q?=D1=82=D0=BE=D0=BD=D0=BE=D0=B2?= Date: Sat, 8 Apr 2023 21:54:57 +0400 Subject: [PATCH] ThirdLaba --- FishFactory/FishFactory.sln | 66 ++++--- .../FishFactoryBusinessLogic.csproj | 4 + .../FishFactoryContracts.csproj | 7 + .../FishFactoryDataModels.csproj | 7 + .../FishFactoryDatabase.cs | 25 +++ .../FishFactoryDatabaseImplement.csproj | 23 +++ .../Implements/CannedStorage.cs | 107 +++++++++++ .../Implements/IngredientStorage.cs | 83 +++++++++ .../Implements/OrderStorage.cs | 93 ++++++++++ .../20230315130506_InitialCreate.Designer.cs | 171 ++++++++++++++++++ .../20230315130506_InitialCreate.cs | 125 +++++++++++++ .../FishFactoryDatabaseModelSnapshot.cs | 168 +++++++++++++++++ .../Models/Canned.cs | 99 ++++++++++ .../Models/CannedIngredient.cs | 22 +++ .../Models/Ingredient.cs | 63 +++++++ .../Models/Order.cs | 64 +++++++ .../FishFactoryFileImplement.csproj | 7 + .../FishFactoryListImplement.csproj | 4 + .../FishFactoryView/FishFactoryView.csproj | 9 + FishFactory/FishFactoryView/Program.cs | 2 +- 20 files changed, 1118 insertions(+), 31 deletions(-) create mode 100644 FishFactory/FishFactoryDatabaseImplement/FishFactoryDatabase.cs create mode 100644 FishFactory/FishFactoryDatabaseImplement/FishFactoryDatabaseImplement.csproj create mode 100644 FishFactory/FishFactoryDatabaseImplement/Implements/CannedStorage.cs create mode 100644 FishFactory/FishFactoryDatabaseImplement/Implements/IngredientStorage.cs create mode 100644 FishFactory/FishFactoryDatabaseImplement/Implements/OrderStorage.cs create mode 100644 FishFactory/FishFactoryDatabaseImplement/Migrations/20230315130506_InitialCreate.Designer.cs create mode 100644 FishFactory/FishFactoryDatabaseImplement/Migrations/20230315130506_InitialCreate.cs create mode 100644 FishFactory/FishFactoryDatabaseImplement/Migrations/FishFactoryDatabaseModelSnapshot.cs create mode 100644 FishFactory/FishFactoryDatabaseImplement/Models/Canned.cs create mode 100644 FishFactory/FishFactoryDatabaseImplement/Models/CannedIngredient.cs create mode 100644 FishFactory/FishFactoryDatabaseImplement/Models/Ingredient.cs create mode 100644 FishFactory/FishFactoryDatabaseImplement/Models/Order.cs diff --git a/FishFactory/FishFactory.sln b/FishFactory/FishFactory.sln index 0a6afb7..2a2e13a 100644 --- a/FishFactory/FishFactory.sln +++ b/FishFactory/FishFactory.sln @@ -3,17 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.3.32825.248 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryDataModels", "FishFactoryDataModels\FishFactoryDataModels.csproj", "{4FAEE923-3CA2-4AFE-9C2C-050BAEE36A29}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryDataModels", "FishFactoryDataModels\FishFactoryDataModels.csproj", "{37D4B025-75B2-4B69-9E3A-72897F6DF370}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryContracts", "FishFactoryContracts\FishFactoryContracts.csproj", "{3B62D774-0DEB-450B-B299-BF6F4A7087BD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryContracts", "FishFactoryContracts\FishFactoryContracts.csproj", "{BC8980F9-E399-46CB-A8DA-CE512D4563B3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryBusinessLogic", "FishFactoryBusinessLogic\FishFactoryBusinessLogic.csproj", "{4D20FEFE-07A7-40F9-8E2E-A94811F92601}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryBusinessLogic", "FishFactoryBusinessLogic\FishFactoryBusinessLogic.csproj", "{15CC37A7-66F1-4CD8-AC4D-5006B6F2684C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryListImplement", "FishFactoryListImplement\FishFactoryListImplement.csproj", "{ED796052-9415-4436-837E-C82D78B10BEB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryListImplement", "FishFactoryListImplement\FishFactoryListImplement.csproj", "{FCFDA778-33D7-42BF-B09C-7C20A2C87672}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryFileImplement", "FishFactoryFileImplement\FishFactoryFileImplement.csproj", "{E898CFA7-2232-4B1C-B36A-9FBC6D841DF4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryFileImplement", "FishFactoryFileImplement\FishFactoryFileImplement.csproj", "{B842D6FF-1528-4AED-9047-6772D4BEB2EF}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryView", "FishFactoryView\FishFactoryView.csproj", "{F5DB1B1C-105F-41D8-9416-6334CD96E838}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryDatabaseImplement", "FishFactoryDatabaseImplement\FishFactoryDatabaseImplement.csproj", "{F5654037-2B5B-4772-B667-B3A085CA9CE5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishFactoryView", "FishFactoryView\FishFactoryView.csproj", "{5A1CA46A-03B0-4641-B89E-18BBA0A26360}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,30 +23,34 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4FAEE923-3CA2-4AFE-9C2C-050BAEE36A29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4FAEE923-3CA2-4AFE-9C2C-050BAEE36A29}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4FAEE923-3CA2-4AFE-9C2C-050BAEE36A29}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4FAEE923-3CA2-4AFE-9C2C-050BAEE36A29}.Release|Any CPU.Build.0 = Release|Any CPU - {3B62D774-0DEB-450B-B299-BF6F4A7087BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B62D774-0DEB-450B-B299-BF6F4A7087BD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B62D774-0DEB-450B-B299-BF6F4A7087BD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B62D774-0DEB-450B-B299-BF6F4A7087BD}.Release|Any CPU.Build.0 = Release|Any CPU - {4D20FEFE-07A7-40F9-8E2E-A94811F92601}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4D20FEFE-07A7-40F9-8E2E-A94811F92601}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4D20FEFE-07A7-40F9-8E2E-A94811F92601}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4D20FEFE-07A7-40F9-8E2E-A94811F92601}.Release|Any CPU.Build.0 = Release|Any CPU - {ED796052-9415-4436-837E-C82D78B10BEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ED796052-9415-4436-837E-C82D78B10BEB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ED796052-9415-4436-837E-C82D78B10BEB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ED796052-9415-4436-837E-C82D78B10BEB}.Release|Any CPU.Build.0 = Release|Any CPU - {E898CFA7-2232-4B1C-B36A-9FBC6D841DF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E898CFA7-2232-4B1C-B36A-9FBC6D841DF4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E898CFA7-2232-4B1C-B36A-9FBC6D841DF4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E898CFA7-2232-4B1C-B36A-9FBC6D841DF4}.Release|Any CPU.Build.0 = Release|Any CPU - {F5DB1B1C-105F-41D8-9416-6334CD96E838}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F5DB1B1C-105F-41D8-9416-6334CD96E838}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F5DB1B1C-105F-41D8-9416-6334CD96E838}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F5DB1B1C-105F-41D8-9416-6334CD96E838}.Release|Any CPU.Build.0 = Release|Any CPU + {37D4B025-75B2-4B69-9E3A-72897F6DF370}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {37D4B025-75B2-4B69-9E3A-72897F6DF370}.Debug|Any CPU.Build.0 = Debug|Any CPU + {37D4B025-75B2-4B69-9E3A-72897F6DF370}.Release|Any CPU.ActiveCfg = Release|Any CPU + {37D4B025-75B2-4B69-9E3A-72897F6DF370}.Release|Any CPU.Build.0 = Release|Any CPU + {BC8980F9-E399-46CB-A8DA-CE512D4563B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BC8980F9-E399-46CB-A8DA-CE512D4563B3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BC8980F9-E399-46CB-A8DA-CE512D4563B3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BC8980F9-E399-46CB-A8DA-CE512D4563B3}.Release|Any CPU.Build.0 = Release|Any CPU + {15CC37A7-66F1-4CD8-AC4D-5006B6F2684C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {15CC37A7-66F1-4CD8-AC4D-5006B6F2684C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {15CC37A7-66F1-4CD8-AC4D-5006B6F2684C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {15CC37A7-66F1-4CD8-AC4D-5006B6F2684C}.Release|Any CPU.Build.0 = Release|Any CPU + {FCFDA778-33D7-42BF-B09C-7C20A2C87672}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FCFDA778-33D7-42BF-B09C-7C20A2C87672}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FCFDA778-33D7-42BF-B09C-7C20A2C87672}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FCFDA778-33D7-42BF-B09C-7C20A2C87672}.Release|Any CPU.Build.0 = Release|Any CPU + {B842D6FF-1528-4AED-9047-6772D4BEB2EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B842D6FF-1528-4AED-9047-6772D4BEB2EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B842D6FF-1528-4AED-9047-6772D4BEB2EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B842D6FF-1528-4AED-9047-6772D4BEB2EF}.Release|Any CPU.Build.0 = Release|Any CPU + {F5654037-2B5B-4772-B667-B3A085CA9CE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F5654037-2B5B-4772-B667-B3A085CA9CE5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F5654037-2B5B-4772-B667-B3A085CA9CE5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F5654037-2B5B-4772-B667-B3A085CA9CE5}.Release|Any CPU.Build.0 = Release|Any CPU + {5A1CA46A-03B0-4641-B89E-18BBA0A26360}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A1CA46A-03B0-4641-B89E-18BBA0A26360}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5A1CA46A-03B0-4641-B89E-18BBA0A26360}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5A1CA46A-03B0-4641-B89E-18BBA0A26360}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/FishFactory/FishFactoryBusinessLogic/FishFactoryBusinessLogic.csproj b/FishFactory/FishFactoryBusinessLogic/FishFactoryBusinessLogic.csproj index cbb2fe0..7448a7c 100644 --- a/FishFactory/FishFactoryBusinessLogic/FishFactoryBusinessLogic.csproj +++ b/FishFactory/FishFactoryBusinessLogic/FishFactoryBusinessLogic.csproj @@ -7,6 +7,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/FishFactory/FishFactoryContracts/FishFactoryContracts.csproj b/FishFactory/FishFactoryContracts/FishFactoryContracts.csproj index 4a17316..5ed46d1 100644 --- a/FishFactory/FishFactoryContracts/FishFactoryContracts.csproj +++ b/FishFactory/FishFactoryContracts/FishFactoryContracts.csproj @@ -6,6 +6,13 @@ enable + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/FishFactory/FishFactoryDataModels/FishFactoryDataModels.csproj b/FishFactory/FishFactoryDataModels/FishFactoryDataModels.csproj index 132c02c..a8bf2a6 100644 --- a/FishFactory/FishFactoryDataModels/FishFactoryDataModels.csproj +++ b/FishFactory/FishFactoryDataModels/FishFactoryDataModels.csproj @@ -6,4 +6,11 @@ enable + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/FishFactory/FishFactoryDatabaseImplement/FishFactoryDatabase.cs b/FishFactory/FishFactoryDatabaseImplement/FishFactoryDatabase.cs new file mode 100644 index 0000000..62177ef --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/FishFactoryDatabase.cs @@ -0,0 +1,25 @@ +using Microsoft.EntityFrameworkCore; +using FishFactoryDatabaseImplement.Models; + +namespace FishFactoryDatabaseImplement +{ + public class FishFactoryDatabase : DbContext + { + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (optionsBuilder.IsConfigured == false) + { + optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-OM38GNQ;Initial Catalog=FishFactoryDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + } + base.OnConfiguring(optionsBuilder); + } + + public virtual DbSet Ingredients { set; get; } + + public virtual DbSet CannedList { set; get; } + + public virtual DbSet CannedIngredients { set; get; } + + public virtual DbSet Orders { set; get; } + } +} diff --git a/FishFactory/FishFactoryDatabaseImplement/FishFactoryDatabaseImplement.csproj b/FishFactory/FishFactoryDatabaseImplement/FishFactoryDatabaseImplement.csproj new file mode 100644 index 0000000..d39908f --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/FishFactoryDatabaseImplement.csproj @@ -0,0 +1,23 @@ + + + + net6.0 + enable + enable + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + diff --git a/FishFactory/FishFactoryDatabaseImplement/Implements/CannedStorage.cs b/FishFactory/FishFactoryDatabaseImplement/Implements/CannedStorage.cs new file mode 100644 index 0000000..5362f88 --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/Implements/CannedStorage.cs @@ -0,0 +1,107 @@ +using Microsoft.EntityFrameworkCore; +using FishFactoryContracts.BindingModels; +using FishFactoryContracts.SearchModels; +using FishFactoryContracts.StoragesContracts; +using FishFactoryContracts.ViewModels; +using FishFactoryDatabaseImplement.Models; + +namespace FishFactoryDatabaseImplement.Implements +{ + public class CannedStorage : ICannedStorage + { + public List GetFullList() + { + using var context = new FishFactoryDatabase(); + return context.CannedList + .Include(x => x.Ingredients) + .ThenInclude(x => x.Ingredient) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFilteredList(CannedSearchModel model) + { + if (string.IsNullOrEmpty(model.CannedName)) + { + return new(); + } + using var context = new FishFactoryDatabase(); + return context.CannedList + .Include(x => x.Ingredients) + .ThenInclude(x => x.Ingredient) + .Where(x => x.CannedName.Contains(model.CannedName)) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public CannedViewModel? GetElement(CannedSearchModel model) + { + if (string.IsNullOrEmpty(model.CannedName) && !model.Id.HasValue) + { + return null; + } + using var context = new FishFactoryDatabase(); + return context.CannedList + .Include(x => x.Ingredients) + .ThenInclude(x => x.Ingredient) + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.CannedName) && x.CannedName == model.CannedName) || + (model.Id.HasValue && x.Id == model.Id)) + ?.GetViewModel; + } + + public CannedViewModel? Insert(CannedBindingModel model) + { + using var context = new FishFactoryDatabase(); + var newCanned = Canned.Create(context, model); + if (newCanned == null) + { + return null; + } + context.CannedList.Add(newCanned); + context.SaveChanges(); + return newCanned.GetViewModel; + } + + public CannedViewModel? Update(CannedBindingModel model) + { + using var context = new FishFactoryDatabase(); + using var transaction = context.Database.BeginTransaction(); + try + { + var Canned = context.CannedList.FirstOrDefault(rec => rec.Id == model.Id); + if (Canned == null) + { + return null; + } + Canned.Update(model); + context.SaveChanges(); + Canned.UpdateIngredients(context, model); + transaction.Commit(); + return Canned.GetViewModel; + } + catch + { + transaction.Rollback(); + throw; + } + } + + public CannedViewModel? Delete(CannedBindingModel model) + { + using var context = new FishFactoryDatabase(); + var element = context.CannedList + .Include(x => x.Ingredients) + .Include(x => x.Orders) + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.CannedList.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + } +} diff --git a/FishFactory/FishFactoryDatabaseImplement/Implements/IngredientStorage.cs b/FishFactory/FishFactoryDatabaseImplement/Implements/IngredientStorage.cs new file mode 100644 index 0000000..2e06928 --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/Implements/IngredientStorage.cs @@ -0,0 +1,83 @@ +using FishFactoryContracts.BindingModels; +using FishFactoryContracts.SearchModels; +using FishFactoryContracts.StoragesContracts; +using FishFactoryContracts.ViewModels; +using FishFactoryDatabaseImplement.Models; + +namespace FishFactoryDatabaseImplement.Implements +{ + public class IngredientStorage : IIngredientStorage + { + public List GetFullList() + { + using var context = new FishFactoryDatabase(); + return context.Ingredients + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFilteredList(IngredientSearchModel model) + { + if (string.IsNullOrEmpty(model.IngredientName)) + { + return new(); + } + using var context = new FishFactoryDatabase(); + return context.Ingredients + .Where(x => x.IngredientName.Contains(model.IngredientName)) + .Select(x => x.GetViewModel) + .ToList(); + } + + public IngredientViewModel? GetElement(IngredientSearchModel model) + { + if (string.IsNullOrEmpty(model.IngredientName) && !model.Id.HasValue) + { + return null; + } + using var context = new FishFactoryDatabase(); + return context.Ingredients + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.IngredientName) && x.IngredientName == model.IngredientName) || + (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; + } + + public IngredientViewModel? Insert(IngredientBindingModel model) + { + var newIngredient = Ingredient.Create(model); + if (newIngredient == null) + { + return null; + } + using var context = new FishFactoryDatabase(); + context.Ingredients.Add(newIngredient); + context.SaveChanges(); + return newIngredient.GetViewModel; + } + + public IngredientViewModel? Update(IngredientBindingModel model) + { + using var context = new FishFactoryDatabase(); + var ingredient = context.Ingredients.FirstOrDefault(x => x.Id == model.Id); + if (ingredient == null) + { + return null; + } + ingredient.Update(model); + context.SaveChanges(); + return ingredient.GetViewModel; + } + + public IngredientViewModel? Delete(IngredientBindingModel model) + { + using var context = new FishFactoryDatabase(); + var element = context.Ingredients.FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Ingredients.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + } +} diff --git a/FishFactory/FishFactoryDatabaseImplement/Implements/OrderStorage.cs b/FishFactory/FishFactoryDatabaseImplement/Implements/OrderStorage.cs new file mode 100644 index 0000000..08ab4ca --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/Implements/OrderStorage.cs @@ -0,0 +1,93 @@ +using Microsoft.EntityFrameworkCore; +using FishFactoryContracts.BindingModels; +using FishFactoryContracts.SearchModels; +using FishFactoryContracts.StoragesContracts; +using FishFactoryContracts.ViewModels; +using FishFactoryDatabaseImplement.Models; + +namespace FishFactoryDatabaseImplement.Implements +{ + public class OrderStorage : IOrderStorage + { + public OrderViewModel? Delete(OrderBindingModel model) + { + using var context = new FishFactoryDatabase(); + var element = context.Orders + .Include(x => x.Canned) + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Orders.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + + public OrderViewModel? GetElement(OrderSearchModel model) + { + if (!model.Id.HasValue) + { + return null; + } + using var context = new FishFactoryDatabase(); + return context.Orders + .Include(x => x.Canned) + .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id) + ?.GetViewModel; + } + + public List GetFilteredList(OrderSearchModel model) + { + if (!model.Id.HasValue) + { + return new(); + } + using var context = new FishFactoryDatabase(); + return context.Orders + .Include(x => x.Canned) + .Where(x => x.Id == model.Id) + .Select(x => x.GetViewModel) + .ToList(); + } + public List GetFullList() + { + using var context = new FishFactoryDatabase(); + return context.Orders + .Include(x => x.Canned) + .Select(x => x.GetViewModel) + .ToList(); + } + + public OrderViewModel? Insert(OrderBindingModel model) + { + var newOrder = Order.Create(model); + if (newOrder == null) + { + return null; + } + using var context = new FishFactoryDatabase(); + context.Orders.Add(newOrder); + context.SaveChanges(); + return context.Orders + .Include(x => x.Canned) + .FirstOrDefault(x => x.Id == newOrder.Id) + ?.GetViewModel; + } + + public OrderViewModel? Update(OrderBindingModel model) + { + using var context = new FishFactoryDatabase(); + var order = context.Orders + .Include(x => x.Canned) + .FirstOrDefault(x => x.Id == model.Id); + if (order == null) + { + return null; + } + order.Update(model); + context.SaveChanges(); + return order.GetViewModel; + } + } +} diff --git a/FishFactory/FishFactoryDatabaseImplement/Migrations/20230315130506_InitialCreate.Designer.cs b/FishFactory/FishFactoryDatabaseImplement/Migrations/20230315130506_InitialCreate.Designer.cs new file mode 100644 index 0000000..1b24eb4 --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/Migrations/20230315130506_InitialCreate.Designer.cs @@ -0,0 +1,171 @@ +// +using System; +using FishFactoryDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FishFactoryDatabaseImplement.Migrations +{ + [DbContext(typeof(FishFactoryDatabase))] + [Migration("20230315130506_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Canned", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CannedName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("CannedList"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.CannedIngredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CannedId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("IngredientId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CannedId"); + + b.HasIndex("IngredientId"); + + b.ToTable("CannedIngredients"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Ingredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Cost") + .HasColumnType("float"); + + b.Property("IngredientName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Ingredients"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CannedId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("CannedId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.CannedIngredient", b => + { + b.HasOne("FishFactoryDatabaseImplement.Models.Canned", "Canned") + .WithMany("Ingredients") + .HasForeignKey("CannedId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FishFactoryDatabaseImplement.Models.Ingredient", "Ingredient") + .WithMany("SushiIngredients") + .HasForeignKey("IngredientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Canned"); + + b.Navigation("Ingredient"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b => + { + b.HasOne("FishFactoryDatabaseImplement.Models.Canned", "Canned") + .WithMany("Orders") + .HasForeignKey("CannedId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Canned"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Canned", b => + { + b.Navigation("Ingredients"); + + b.Navigation("Orders"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Ingredient", b => + { + b.Navigation("SushiIngredients"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FishFactory/FishFactoryDatabaseImplement/Migrations/20230315130506_InitialCreate.cs b/FishFactory/FishFactoryDatabaseImplement/Migrations/20230315130506_InitialCreate.cs new file mode 100644 index 0000000..cfe0467 --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/Migrations/20230315130506_InitialCreate.cs @@ -0,0 +1,125 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FishFactoryDatabaseImplement.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "CannedList", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CannedName = table.Column(type: "nvarchar(max)", nullable: false), + Price = table.Column(type: "float", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CannedList", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Ingredients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + IngredientName = table.Column(type: "nvarchar(max)", nullable: false), + Cost = table.Column(type: "float", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Ingredients", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Orders", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CannedId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false), + Sum = table.Column(type: "float", nullable: false), + Status = table.Column(type: "int", nullable: false), + DateCreate = table.Column(type: "datetime2", nullable: false), + DateImplement = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Orders", x => x.Id); + table.ForeignKey( + name: "FK_Orders_CannedList_CannedId", + column: x => x.CannedId, + principalTable: "CannedList", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "CannedIngredients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CannedId = table.Column(type: "int", nullable: false), + IngredientId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CannedIngredients", x => x.Id); + table.ForeignKey( + name: "FK_CannedIngredients_CannedList_CannedId", + column: x => x.CannedId, + principalTable: "CannedList", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CannedIngredients_Ingredients_IngredientId", + column: x => x.IngredientId, + principalTable: "Ingredients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_CannedIngredients_CannedId", + table: "CannedIngredients", + column: "CannedId"); + + migrationBuilder.CreateIndex( + name: "IX_CannedIngredients_IngredientId", + table: "CannedIngredients", + column: "IngredientId"); + + migrationBuilder.CreateIndex( + name: "IX_Orders_CannedId", + table: "Orders", + column: "CannedId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CannedIngredients"); + + migrationBuilder.DropTable( + name: "Orders"); + + migrationBuilder.DropTable( + name: "Ingredients"); + + migrationBuilder.DropTable( + name: "CannedList"); + } + } +} diff --git a/FishFactory/FishFactoryDatabaseImplement/Migrations/FishFactoryDatabaseModelSnapshot.cs b/FishFactory/FishFactoryDatabaseImplement/Migrations/FishFactoryDatabaseModelSnapshot.cs new file mode 100644 index 0000000..d2f3cb1 --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/Migrations/FishFactoryDatabaseModelSnapshot.cs @@ -0,0 +1,168 @@ +// +using System; +using FishFactoryDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FishFactoryDatabaseImplement.Migrations +{ + [DbContext(typeof(FishFactoryDatabase))] + partial class FishFactoryDatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Canned", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CannedName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("CannedList"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.CannedIngredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CannedId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("IngredientId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CannedId"); + + b.HasIndex("IngredientId"); + + b.ToTable("CannedIngredients"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Ingredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Cost") + .HasColumnType("float"); + + b.Property("IngredientName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Ingredients"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CannedId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("CannedId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.CannedIngredient", b => + { + b.HasOne("FishFactoryDatabaseImplement.Models.Canned", "Canned") + .WithMany("Ingredients") + .HasForeignKey("CannedId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FishFactoryDatabaseImplement.Models.Ingredient", "Ingredient") + .WithMany("SushiIngredients") + .HasForeignKey("IngredientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Canned"); + + b.Navigation("Ingredient"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b => + { + b.HasOne("FishFactoryDatabaseImplement.Models.Canned", "Canned") + .WithMany("Orders") + .HasForeignKey("CannedId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Canned"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Canned", b => + { + b.Navigation("Ingredients"); + + b.Navigation("Orders"); + }); + + modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Ingredient", b => + { + b.Navigation("SushiIngredients"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FishFactory/FishFactoryDatabaseImplement/Models/Canned.cs b/FishFactory/FishFactoryDatabaseImplement/Models/Canned.cs new file mode 100644 index 0000000..9bbc293 --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/Models/Canned.cs @@ -0,0 +1,99 @@ +using FishFactoryContracts.BindingModels; +using FishFactoryContracts.ViewModels; +using FishFactoryDataModels.Models; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace FishFactoryDatabaseImplement.Models +{ + public class Canned : ICannedModel + { + public int Id { get; set; } + + [Required] + public string CannedName { get; set; } = string.Empty; + + [Required] + public double Price { get; set; } + + private Dictionary? _cannedIngredients = null; + + [NotMapped] + public Dictionary CannedIngredients + { + get + { + if (_cannedIngredients == null) + { + _cannedIngredients = Ingredients + .ToDictionary(recPC => recPC.IngredientId, recPC => (recPC.Ingredient as IIngredientModel, recPC.Count)); + } + return _cannedIngredients; + } + } + + [ForeignKey("CannedId")] + public virtual List Ingredients { get; set; } = new(); + + [ForeignKey("CannedId")] + public virtual List Orders { get; set; } = new(); + + public static Canned Create(FishFactoryDatabase context, CannedBindingModel model) + { + return new Canned() + { + Id = model.Id, + CannedName = model.CannedName, + Price = model.Price, + Ingredients = model.CannedIngredients.Select(x => new CannedIngredient + { + Ingredient = context.Ingredients.First(y => y.Id == x.Key), + Count = x.Value.Item2 + }).ToList() + }; + } + + public void Update(CannedBindingModel model) + { + CannedName = model.CannedName; + Price = model.Price; + } + + public CannedViewModel GetViewModel => new() + { + Id = Id, + CannedName = CannedName, + Price = Price, + CannedIngredients = CannedIngredients + }; + + public void UpdateIngredients(FishFactoryDatabase context, CannedBindingModel model) + { + var cannedIngredients = context.CannedIngredients.Where(rec => rec.CannedId == model.Id).ToList(); + if (cannedIngredients != null && cannedIngredients.Count > 0) + { // удалили те, которых нет в модели + context.CannedIngredients.RemoveRange(cannedIngredients.Where(rec => !model.CannedIngredients.ContainsKey(rec.IngredientId))); + context.SaveChanges(); + // обновили количество у существующих записей + foreach (var updateIngredient in cannedIngredients) + { + updateIngredient.Count = model.CannedIngredients[updateIngredient.IngredientId].Item2; + model.CannedIngredients.Remove(updateIngredient.IngredientId); + } + context.SaveChanges(); + } + var canned = context.CannedList.First(x => x.Id == Id); + foreach (var cd in model.CannedIngredients) + { + context.CannedIngredients.Add(new CannedIngredient + { + Canned = canned, + Ingredient = context.Ingredients.First(x => x.Id == cd.Key), + Count = cd.Value.Item2 + }); + context.SaveChanges(); + } + _cannedIngredients = null; + } + } +} \ No newline at end of file diff --git a/FishFactory/FishFactoryDatabaseImplement/Models/CannedIngredient.cs b/FishFactory/FishFactoryDatabaseImplement/Models/CannedIngredient.cs new file mode 100644 index 0000000..0bd7a42 --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/Models/CannedIngredient.cs @@ -0,0 +1,22 @@ +using System.ComponentModel.DataAnnotations; + +namespace FishFactoryDatabaseImplement.Models +{ + public class CannedIngredient + { + public int Id { get; set; } + + [Required] + public int CannedId { get; set; } + + [Required] + public int IngredientId { get; set; } + + [Required] + public int Count { get; set; } + + public virtual Ingredient Ingredient { get; set; } = new(); + + public virtual Canned Canned { get; set; } = new(); + } +} \ No newline at end of file diff --git a/FishFactory/FishFactoryDatabaseImplement/Models/Ingredient.cs b/FishFactory/FishFactoryDatabaseImplement/Models/Ingredient.cs new file mode 100644 index 0000000..6993746 --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/Models/Ingredient.cs @@ -0,0 +1,63 @@ +using FishFactoryContracts.BindingModels; +using FishFactoryContracts.ViewModels; +using FishFactoryDataModels.Models; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace FishFactoryDatabaseImplement.Models +{ + public class Ingredient : IIngredientModel + { + public int Id { get; private set; } + + [Required] + public string IngredientName { get; private set; } = string.Empty; + + [Required] + public double Cost { get; set; } + + [ForeignKey("IngredientId")] + public virtual List SushiIngredients { get; set; } = new(); + + public static Ingredient? Create(IngredientBindingModel model) + { + if (model == null) + { + return null; + } + return new Ingredient() + { + Id = model.Id, + IngredientName = model.IngredientName, + Cost = model.Cost + }; + } + + public static Ingredient Create(IngredientViewModel model) + { + return new Ingredient + { + Id = model.Id, + IngredientName = model.IngredientName, + Cost = model.Cost + }; + } + + public void Update(IngredientBindingModel model) + { + if (model == null) + { + return; + } + IngredientName = model.IngredientName; + Cost = model.Cost; + } + + public IngredientViewModel GetViewModel => new() + { + Id = Id, + IngredientName = IngredientName, + Cost = Cost + }; + } +} diff --git a/FishFactory/FishFactoryDatabaseImplement/Models/Order.cs b/FishFactory/FishFactoryDatabaseImplement/Models/Order.cs new file mode 100644 index 0000000..29a0ed8 --- /dev/null +++ b/FishFactory/FishFactoryDatabaseImplement/Models/Order.cs @@ -0,0 +1,64 @@ +using FishFactoryContracts.BindingModels; +using FishFactoryContracts.ViewModels; +using FishFactoryDataModels.Models; +using FishFactoryDataModels.Enums; +using System.ComponentModel.DataAnnotations; + +namespace FishFactoryDatabaseImplement.Models +{ + public class Order : IOrderModel + { + [Required] + public int CannedId { get; set; } + [Required] + public int Count { get; set; } + [Required] + public double Sum { get; set; } + [Required] + public OrderStatus Status { get; set; } + [Required] + public DateTime DateCreate { get; set; } + public DateTime? DateImplement { get; set; } + public int Id { get; set; } + public Canned Canned { get; set; } + public static Order? Create(OrderBindingModel? model) + { + if (model == null) + { + return null; + } + return new Order() + { + Id = model.Id, + CannedId = model.CannedId, + Count = model.Count, + Sum = model.Sum, + Status = model.Status, + DateCreate = model.DateCreate, + DateImplement = model.DateImplement, + }; + } + + public void Update(OrderBindingModel? model) + { + if (model == null) + { + return; + } + Status = model.Status; + DateImplement = model.DateImplement; + } + + public OrderViewModel GetViewModel => new() + { + CannedId = CannedId, + Count = Count, + Sum = Sum, + DateCreate = DateCreate, + DateImplement = DateImplement, + Id = Id, + Status = Status, + CannedName = Canned.CannedName, + }; + } +} diff --git a/FishFactory/FishFactoryFileImplement/FishFactoryFileImplement.csproj b/FishFactory/FishFactoryFileImplement/FishFactoryFileImplement.csproj index b2c107f..26c6f57 100644 --- a/FishFactory/FishFactoryFileImplement/FishFactoryFileImplement.csproj +++ b/FishFactory/FishFactoryFileImplement/FishFactoryFileImplement.csproj @@ -6,6 +6,13 @@ enable + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/FishFactory/FishFactoryListImplement/FishFactoryListImplement.csproj b/FishFactory/FishFactoryListImplement/FishFactoryListImplement.csproj index 6d7e23b..b525cd1 100644 --- a/FishFactory/FishFactoryListImplement/FishFactoryListImplement.csproj +++ b/FishFactory/FishFactoryListImplement/FishFactoryListImplement.csproj @@ -7,6 +7,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/FishFactory/FishFactoryView/FishFactoryView.csproj b/FishFactory/FishFactoryView/FishFactoryView.csproj index 70b52c5..b98d4d7 100644 --- a/FishFactory/FishFactoryView/FishFactoryView.csproj +++ b/FishFactory/FishFactoryView/FishFactoryView.csproj @@ -9,6 +9,14 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -16,6 +24,7 @@ + diff --git a/FishFactory/FishFactoryView/Program.cs b/FishFactory/FishFactoryView/Program.cs index 2a307f9..ad5f467 100644 --- a/FishFactory/FishFactoryView/Program.cs +++ b/FishFactory/FishFactoryView/Program.cs @@ -4,7 +4,7 @@ using NLog.Extensions.Logging; using FishFactoryBusinessLogic.BusinessLogics; using FishFactoryContracts.BusinessLogicsContracts; using FishFactoryContracts.StoragesContracts; -using FishFactoryFileImplement.Implements; +using FishFactoryDatabaseImplement.Implements; using FishFactoryView; namespace FishFactoryView -- 2.25.1