ПИбд-23 Салин Олег Алексеевич Лабораторная работа №3 #9

Closed
Oleja123 wants to merge 6 commits from Lab3 into Lab2
4 changed files with 8 additions and 21 deletions
Showing only changes of commit a94e774482 - Show all commits

View File

@ -1,7 +0,0 @@
namespace ClassLibrary1
{
public class Class1
{
}
}

View File

@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IceCreamShop", "IceCreamShop\IceCreamShop.csproj", "{CD111C92-FD71-4F7E-A7E7-03C273B634E6}"
ProjectSection(ProjectDependencies) = postProject
{CAF716C0-0F6F-43C2-B6F6-903AA9D96FC5} = {CAF716C0-0F6F-43C2-B6F6-903AA9D96FC5}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IceCreamShopDataModels", "IceCreamShopDataModels\IceCreamShopDataModels.csproj", "{0979632B-BB70-441E-9109-C52DBA5A85B2}"
EndProject
@ -15,7 +18,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IceCreamShopListImplement",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IceCreamShopFileImplement", "IceCreamShopFileImplement\IceCreamShopFileImplement.csproj", "{A689B62C-67DF-47D8-B265-6C453D1055DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IceCreamShopDatabaseImplement", "IceCreamShopDatabaseImplement\IceCreamShopDatabaseImplement.csproj", "{CAF716C0-0F6F-43C2-B6F6-903AA9D96FC5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IceCreamShopDatabaseImplement", "IceCreamShopDatabaseImplement\IceCreamShopDatabaseImplement.csproj", "{CAF716C0-0F6F-43C2-B6F6-903AA9D96FC5}"
ProjectSection(ProjectDependencies) = postProject
{0979632B-BB70-441E-9109-C52DBA5A85B2} = {0979632B-BB70-441E-9109-C52DBA5A85B2}
{8D344A7A-951D-496B-BC8A-DF18A06B1DF0} = {8D344A7A-951D-496B-BC8A-DF18A06B1DF0}

View File

@ -58,14 +58,14 @@ namespace IceCreamShopDatabaseImplement.Implements
public IceCreamViewModel? Insert(IceCreamBindingModel model)
{
using var context = new IceCreamShopDataBase();
var newProduct = IceCream.Create(context, model);
if (newProduct == null)
var newIceCream = IceCream.Create(context, model);
if (newIceCream == null)
{
return null;
}
context.IceCreams.Add(newProduct);
context.IceCreams.Add(newIceCream);
context.SaveChanges();
return newProduct.GetViewModel;
return newIceCream.GetViewModel;
}
public IceCreamViewModel? Update(IceCreamBindingModel model)
{