diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln index 8fb11cd..7188e03 100644 --- a/SushiBar/SushiBar.sln +++ b/SushiBar/SushiBar.sln @@ -3,18 +3,20 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34525.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarView", "SushiBarView.csproj", "{E1025CC0-5650-4509-93C8-BF4FA2D506E0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarView", "SushiBarView.csproj", "{E1025CC0-5650-4509-93C8-BF4FA2D506E0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarDataModels", "..\SushiBarDataModels\SushiBarDataModels.csproj", "{98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDataModels", "..\SushiBarDataModels\SushiBarDataModels.csproj", "{98946D8E-A8FC-40DC-9FC8-BCBBC6BD6688}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarContracts", "..\SushiBarContracts\SushiBarContracts.csproj", "{0C8B928F-ACD2-4196-8F2B-5190914911D8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarContracts", "..\SushiBarContracts\SushiBarContracts.csproj", "{0C8B928F-ACD2-4196-8F2B-5190914911D8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarBusinessLogic", "..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj", "{B4061C5A-A7C4-4F49-A1AC-083877203CD8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarBusinessLogic", "..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj", "{B4061C5A-A7C4-4F49-A1AC-083877203CD8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarListImplements", "..\SushiBarListImplements\SushiBarListImplements.csproj", "{BAA05DBA-C77F-4CF6-9998-4C150FA5797C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarListImplements", "..\SushiBarListImplements\SushiBarListImplements.csproj", "{BAA05DBA-C77F-4CF6-9998-4C150FA5797C}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarFileImplement", "..\SushiBarFileImplement\SushiBarFileImplement.csproj", "{15B17431-20EB-4A87-9088-C19E5C2DD209}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarDatabaseImplement", "..\SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj", "{920F7D63-E1A0-4629-8322-AAD4A5F5ECAF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,6 +47,10 @@ Global {15B17431-20EB-4A87-9088-C19E5C2DD209}.Debug|Any CPU.Build.0 = Debug|Any CPU {15B17431-20EB-4A87-9088-C19E5C2DD209}.Release|Any CPU.ActiveCfg = Release|Any CPU {15B17431-20EB-4A87-9088-C19E5C2DD209}.Release|Any CPU.Build.0 = Release|Any CPU + {920F7D63-E1A0-4629-8322-AAD4A5F5ECAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {920F7D63-E1A0-4629-8322-AAD4A5F5ECAF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {920F7D63-E1A0-4629-8322-AAD4A5F5ECAF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {920F7D63-E1A0-4629-8322-AAD4A5F5ECAF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SushiBar/SushiBarView.csproj b/SushiBar/SushiBarView.csproj index 8bedfbf..fcd104a 100644 --- a/SushiBar/SushiBarView.csproj +++ b/SushiBar/SushiBarView.csproj @@ -9,6 +9,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -19,6 +23,7 @@ + diff --git a/SushiBarDatabaseImplement/Models/Component.cs b/SushiBarDatabaseImplement/Models/Component.cs new file mode 100644 index 0000000..925d3a2 --- /dev/null +++ b/SushiBarDatabaseImplement/Models/Component.cs @@ -0,0 +1,56 @@ +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using SushiBarDataModels.Models; +using SushiBarContracts.BindingModel; +using SushiBarContracts.ViewModels; + +namespace SushiBarDatabaseImplement.Models +{ + public class Component : IComponentModel + { + public int Id { get; private set; } + [Required] + public string ComponentName { get; private set; } = string.Empty; + [Required] + public double Cost { get; set; } + [ForeignKey("ComponentId")] + public virtual List ProductComponents { get; set; } = new(); + public static Component? Create(ComponentBindingModel model) + { + if (model == null) + { + return null; + } + return new Component() + { + Id = model.Id, + ComponentName = model.ComponentName, + Cost = model.Cost + }; + } + public static Component Create(ComponentViewModel model) + { + 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 + }; + } +} diff --git a/SushiBarDatabaseImplement/Models/Order.cs b/SushiBarDatabaseImplement/Models/Order.cs new file mode 100644 index 0000000..da6ff04 --- /dev/null +++ b/SushiBarDatabaseImplement/Models/Order.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarDatabaseImplement.Models +{ + internal class Order + { + } +} diff --git a/SushiBarDatabaseImplement/Models/Sushi.cs b/SushiBarDatabaseImplement/Models/Sushi.cs new file mode 100644 index 0000000..a47f437 --- /dev/null +++ b/SushiBarDatabaseImplement/Models/Sushi.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarDatabaseImplement.Models +{ + internal class Sushi + { + } +} diff --git a/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj b/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj new file mode 100644 index 0000000..c1918fe --- /dev/null +++ b/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj @@ -0,0 +1,23 @@ + + + + net8.0 + enable + enable + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + +