diff --git a/SushiBar/SushiBarDatabaseImplement/Implements/SushiStorage.cs b/SushiBar/SushiBarDatabaseImplement/Implements/SushiStorage.cs index 6f85ecb..02b08f1 100644 --- a/SushiBar/SushiBarDatabaseImplement/Implements/SushiStorage.cs +++ b/SushiBar/SushiBarDatabaseImplement/Implements/SushiStorage.cs @@ -12,7 +12,7 @@ namespace SushiBarDatabaseImplement.Implements public List GetFullList() { using var context = new SushiBarDatabase(); - return context.SushiList + return context.ListSushi .Include(x => x.Ingredients) .ThenInclude(x => x.Ingredient) .ToList() @@ -27,7 +27,7 @@ namespace SushiBarDatabaseImplement.Implements return new(); } using var context = new SushiBarDatabase(); - return context.SushiList + return context.ListSushi .Include(x => x.Ingredients) .ThenInclude(x => x.Ingredient) .Where(x => x.SushiName.Contains(model.SushiName)) @@ -43,7 +43,7 @@ namespace SushiBarDatabaseImplement.Implements return null; } using var context = new SushiBarDatabase(); - return context.SushiList + return context.ListSushi .Include(x => x.Ingredients) .ThenInclude(x => x.Ingredient) .FirstOrDefault(x => (!string.IsNullOrEmpty(model.SushiName) && x.SushiName == model.SushiName) || @@ -59,7 +59,7 @@ namespace SushiBarDatabaseImplement.Implements { return null; } - context.SushiList.Add(newSushi); + context.ListSushi.Add(newSushi); context.SaveChanges(); return newSushi.GetViewModel; } @@ -70,7 +70,7 @@ namespace SushiBarDatabaseImplement.Implements using var transaction = context.Database.BeginTransaction(); try { - var sushi = context.SushiList.FirstOrDefault(rec => rec.Id == model.Id); + var sushi = context.ListSushi.FirstOrDefault(rec => rec.Id == model.Id); if (sushi == null) { return null; @@ -91,13 +91,13 @@ namespace SushiBarDatabaseImplement.Implements public SushiViewModel? Delete(SushiBindingModel model) { using var context = new SushiBarDatabase(); - var element = context.SushiList + var element = context.ListSushi .Include(x => x.Ingredients) .Include(x => x.Orders) .FirstOrDefault(rec => rec.Id == model.Id); if (element != null) { - context.SushiList.Remove(element); + context.ListSushi.Remove(element); context.SaveChanges(); return element.GetViewModel; } diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/20230227162916_InitMigration.Designer.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/20230227162916_InitMigration.Designer.cs index 04659c4..d75219a 100644 --- a/SushiBar/SushiBarDatabaseImplement/Migrations/20230227162916_InitMigration.Designer.cs +++ b/SushiBar/SushiBarDatabaseImplement/Migrations/20230227162916_InitMigration.Designer.cs @@ -93,7 +93,7 @@ namespace SushiBarDatabaseImplement.Migrations b.HasKey("Id"); - b.ToTable("SushiList"); + b.ToTable("ListSushi"); }); modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiIngredient", b => diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/20230227162916_InitMigration.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/20230227162916_InitMigration.cs index d1b6e7b..729d675 100644 --- a/SushiBar/SushiBarDatabaseImplement/Migrations/20230227162916_InitMigration.cs +++ b/SushiBar/SushiBarDatabaseImplement/Migrations/20230227162916_InitMigration.cs @@ -44,7 +44,7 @@ namespace SushiBarDatabaseImplement.Migrations }); migrationBuilder.CreateTable( - name: "SushiList", + name: "ListSushi", columns: table => new { Id = table.Column(type: "int", nullable: false) @@ -54,7 +54,7 @@ namespace SushiBarDatabaseImplement.Migrations }, constraints: table => { - table.PrimaryKey("PK_SushiList", x => x.Id); + table.PrimaryKey("PK_ListSushi", x => x.Id); }); migrationBuilder.CreateTable( @@ -77,9 +77,9 @@ namespace SushiBarDatabaseImplement.Migrations principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_SushiIngredients_SushiList_SushiId", + name: "FK_SushiIngredients_ListSushi_SushiId", column: x => x.SushiId, - principalTable: "SushiList", + principalTable: "ListSushi", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); @@ -108,7 +108,7 @@ namespace SushiBarDatabaseImplement.Migrations name: "Ingredients"); migrationBuilder.DropTable( - name: "SushiList"); + name: "ListSushi"); } } } diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/20230227181342_SecondMigration.Designer.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/20230227181342_SecondMigration.Designer.cs index 5d10487..e1e6ddb 100644 --- a/SushiBar/SushiBarDatabaseImplement/Migrations/20230227181342_SecondMigration.Designer.cs +++ b/SushiBar/SushiBarDatabaseImplement/Migrations/20230227181342_SecondMigration.Designer.cs @@ -95,7 +95,7 @@ namespace SushiBarDatabaseImplement.Migrations b.HasKey("Id"); - b.ToTable("SushiList"); + b.ToTable("ListSushi"); }); modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiIngredient", b => diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/20230227181342_SecondMigration.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/20230227181342_SecondMigration.cs index 8c815e1..8d56dd0 100644 --- a/SushiBar/SushiBarDatabaseImplement/Migrations/20230227181342_SecondMigration.cs +++ b/SushiBar/SushiBarDatabaseImplement/Migrations/20230227181342_SecondMigration.cs @@ -16,10 +16,10 @@ namespace SushiBarDatabaseImplement.Migrations column: "SushiId"); migrationBuilder.AddForeignKey( - name: "FK_Orders_SushiList_SushiId", + name: "FK_Orders_ListSushi_SushiId", table: "Orders", column: "SushiId", - principalTable: "SushiList", + principalTable: "ListSushi", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } @@ -28,7 +28,7 @@ namespace SushiBarDatabaseImplement.Migrations protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( - name: "FK_Orders_SushiList_SushiId", + name: "FK_Orders_ListSushi_SushiId", table: "Orders"); migrationBuilder.DropIndex( diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs index 34ee42b..a9956bd 100644 --- a/SushiBar/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs +++ b/SushiBar/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs @@ -88,7 +88,7 @@ namespace SushiBarDatabaseImplement.Migrations b.HasKey("Id"); - b.ToTable("SushiList"); + b.ToTable("ListSushi"); }); modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiIngredient", b => diff --git a/SushiBar/SushiBarDatabaseImplement/Models/Sushi.cs b/SushiBar/SushiBarDatabaseImplement/Models/Sushi.cs index 5e93501..009329f 100644 --- a/SushiBar/SushiBarDatabaseImplement/Models/Sushi.cs +++ b/SushiBar/SushiBarDatabaseImplement/Models/Sushi.cs @@ -81,7 +81,7 @@ namespace SushiBarDatabaseImplement.Models } context.SaveChanges(); } - var sushi = context.SushiList.First(x => x.Id == Id); + var sushi = context.ListSushi.First(x => x.Id == Id); foreach (var si in model.SushiIngredients) { context.SushiIngredients.Add(new SushiIngredient diff --git a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs index 58f8313..1e0447f 100644 --- a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs +++ b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs @@ -16,7 +16,7 @@ namespace SushiBarDatabaseImplement public virtual DbSet Ingredients { set; get; } - public virtual DbSet SushiList { set; get; } + public virtual DbSet ListSushi { set; get; } public virtual DbSet SushiIngredients { set; get; }