diff --git a/FishFactory/FormCanned.cs b/FishFactory/FormCanned.cs index ffe2997..8b515ea 100644 --- a/FishFactory/FormCanned.cs +++ b/FishFactory/FormCanned.cs @@ -1,14 +1,5 @@ using FishFactoryDataModel.Models; using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; using FishFactoryContracts.BusinessLogicsContracts; using FishFactoryContracts.SearchModels; using FishFactoryContracts.BindingModels; diff --git a/FishFactoryDatabaseImplement/FishFactoryDatabase.cs b/FishFactoryDatabaseImplement/FishFactoryDatabase.cs index d93d11d..16b5a6e 100644 --- a/FishFactoryDatabaseImplement/FishFactoryDatabase.cs +++ b/FishFactoryDatabaseImplement/FishFactoryDatabase.cs @@ -9,7 +9,7 @@ namespace FishFactoryDatabaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory;Username=postgres;Password=postgres"); + optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory2;Username=postgres;Password=postgres"); } base.OnConfiguring(optionsBuilder); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); diff --git a/FishFactoryDatabaseImplement/Migrations/20240319164852_InitialCreate.Designer.cs b/FishFactoryDatabaseImplement/Migrations/20240320065127_InitialCreate.Designer.cs similarity index 99% rename from FishFactoryDatabaseImplement/Migrations/20240319164852_InitialCreate.Designer.cs rename to FishFactoryDatabaseImplement/Migrations/20240320065127_InitialCreate.Designer.cs index a9f77ff..cd51fe7 100644 --- a/FishFactoryDatabaseImplement/Migrations/20240319164852_InitialCreate.Designer.cs +++ b/FishFactoryDatabaseImplement/Migrations/20240320065127_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace FishFactoryDatabaseImplement.Migrations { [DbContext(typeof(FishFactoryDatabase))] - [Migration("20240319164852_InitialCreate")] + [Migration("20240320065127_InitialCreate")] partial class InitialCreate { /// diff --git a/FishFactoryDatabaseImplement/Migrations/20240319164852_InitialCreate.cs b/FishFactoryDatabaseImplement/Migrations/20240320065127_InitialCreate.cs similarity index 100% rename from FishFactoryDatabaseImplement/Migrations/20240319164852_InitialCreate.cs rename to FishFactoryDatabaseImplement/Migrations/20240320065127_InitialCreate.cs diff --git a/FishFactoryDatabaseImplement/Models/Canned.cs b/FishFactoryDatabaseImplement/Models/Canned.cs index 9202805..9bbb908 100644 --- a/FishFactoryDatabaseImplement/Models/Canned.cs +++ b/FishFactoryDatabaseImplement/Models/Canned.cs @@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations; namespace FishFactoryDatabaseImplement.Models { - public class Canned + public class Canned : ICannedModel { public int Id { get; set; } [Required] diff --git a/FishFactoryDatabaseImplement/Models/Order.cs b/FishFactoryDatabaseImplement/Models/Order.cs index 7b2096a..62ce8dc 100644 --- a/FishFactoryDatabaseImplement/Models/Order.cs +++ b/FishFactoryDatabaseImplement/Models/Order.cs @@ -3,10 +3,11 @@ using System.ComponentModel.DataAnnotations; using FishFactoryDataModel.Enums; using FishFactoryContracts.BindingModels; using FishFactoryContracts.ViewModels; +using FishFactoryDataModel.Models; namespace FishFactoryDatabaseImplement.Models { - public class Order + public class Order : IOrderModel { public int Id { get; private set; } [Required] @@ -27,6 +28,7 @@ namespace FishFactoryDatabaseImplement.Models { Id = model.Id, CannedId = model.CannedId, + Canned = context.Canneds.First(x => x.Id == model.CannedId), Count = model.Count, Sum = model.Sum, Status = model.Status,