Base fixes
This commit is contained in:
parent
b37e13575b
commit
8a4b8a5f79
@ -0,0 +1,38 @@
|
||||
using ComputerStoreContracts.BusinessLogicContracts;
|
||||
using ComputerStoreContracts.SearchModels;
|
||||
using ComputerStoreContracts.StorageContracts;
|
||||
using ComputerStoreContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerStoreBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class RequestComponentLogic : IRequestComponentLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRequestComponentStorage _requestComponentStorage;
|
||||
public RequestComponentLogic(ILogger<PCLogic> logger, IRequestComponentStorage requestComponentStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_requestComponentStorage = requestComponentStorage;
|
||||
}
|
||||
|
||||
public List<RequestComponentViewModel>? ReadList(RequestSearchModel model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. PCID:{ PCID}. OrderID:{ OrderID}. ID:{ ID}", model?.PCID, model?.OrderID,model?.ID);
|
||||
var list = model.ID == null ? _requestComponentStorage.GetFullList() : _requestComponentStorage.GetFilteredList(model);
|
||||
|
||||
if(list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return new();
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using ComputerStoreContracts.SearchModels;
|
||||
using ComputerStoreContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerStoreContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IRequestComponentLogic
|
||||
{
|
||||
List<RequestComponentViewModel>? ReadList(RequestSearchModel? model);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using ComputerStoreContracts.SearchModels;
|
||||
using ComputerStoreContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerStoreContracts.StorageContracts
|
||||
{
|
||||
public interface IRequestComponentStorage
|
||||
{
|
||||
List<RequestComponentViewModel> GetFullList();
|
||||
List<RequestComponentViewModel> GetFilteredList(RequestSearchModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerStoreContracts.ViewModels
|
||||
{
|
||||
public class RequestComponentViewModel
|
||||
{
|
||||
[DisplayName("RequestID")]
|
||||
public int RequestID { get; set; }
|
||||
|
||||
[DisplayName("ComponentID")]
|
||||
public int ComponentID { get; set; }
|
||||
|
||||
[DisplayName("Component's name")]
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Component's count")]
|
||||
public int ComponentCount { get; set; }
|
||||
|
||||
[DisplayName("PCID")]
|
||||
public int PCID { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
using ComputerStoreContracts.SearchModels;
|
||||
using ComputerStoreContracts.StorageContracts;
|
||||
using ComputerStoreContracts.ViewModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerStoreDatabaseImplement.Implements
|
||||
{
|
||||
public class RequestComponentStorage : IRequestComponentStorage
|
||||
{
|
||||
public List<RequestComponentViewModel> GetFilteredList(RequestSearchModel model)
|
||||
{
|
||||
using var context = new ComputerStoreDatabase();
|
||||
var list = new List<RequestComponentViewModel>();
|
||||
foreach (var pc in context.RequestComponents.Include(x => x.Component).Include(x => x.Request).Where(x => x.PCID == null && x.RequestID == model.ID))
|
||||
{
|
||||
list.Add(new RequestComponentViewModel
|
||||
{
|
||||
RequestID = pc.RequestID,
|
||||
ComponentID = pc.ComponentID,
|
||||
ComponentName = pc.Component.Name,
|
||||
ComponentCount = pc.Count,
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<RequestComponentViewModel> GetFullList()
|
||||
{
|
||||
using var context = new ComputerStoreDatabase();
|
||||
|
||||
var list = new List<RequestComponentViewModel>();
|
||||
|
||||
foreach(var pc in context.RequestComponents.Include(x => x.Component).Include(x => x.Request).Where(x => x.PCID == null))
|
||||
{
|
||||
list.Add(new RequestComponentViewModel {
|
||||
RequestID = pc.RequestID,
|
||||
ComponentID = pc.ComponentID,
|
||||
ComponentName = pc.Component.Name,
|
||||
ComponentCount = pc.Count,
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
499
ComputerStoreDatabaseImplement/Migrations/20230516114631_fieldFixes.Designer.cs
generated
Normal file
499
ComputerStoreDatabaseImplement/Migrations/20230516114631_fieldFixes.Designer.cs
generated
Normal file
@ -0,0 +1,499 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ComputerStoreDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerStoreDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(ComputerStoreDatabase))]
|
||||
[Migration("20230516114631_fieldFixes")]
|
||||
partial class fieldFixes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Consignment", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<int>("OrderID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int?>("ProductID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("OrderID");
|
||||
|
||||
b.HasIndex("ProductID");
|
||||
|
||||
b.ToTable("Consignments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ConsignmentProduct", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<int>("ConsignmentID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProductID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("ConsignmentID");
|
||||
|
||||
b.HasIndex("ProductID");
|
||||
|
||||
b.ToTable("ConsignmentProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Employee", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MiddleName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.ToTable("Employees");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("OrderID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("SellerID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("OrderID");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.PC", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<int>("EmployeeID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("RequestID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("EmployeeID");
|
||||
|
||||
b.ToTable("PCs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<int>("EmployeeID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("EmployeeID");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<int>("ComponentID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProductID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("ComponentID");
|
||||
|
||||
b.HasIndex("ProductID");
|
||||
|
||||
b.ToTable("ProductComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<int>("OrderID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("PCID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("OrderID");
|
||||
|
||||
b.ToTable("Requests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.RequestComponent", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<int>("ComponentID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("PCID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RequestID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("ComponentID");
|
||||
|
||||
b.HasIndex("PCID");
|
||||
|
||||
b.HasIndex("RequestID");
|
||||
|
||||
b.ToTable("RequestComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Seller", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MiddleName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.ToTable("Sellers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Consignment", b =>
|
||||
{
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("_consignments")
|
||||
.HasForeignKey("OrderID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Product", null)
|
||||
.WithMany("Consignments")
|
||||
.HasForeignKey("ProductID");
|
||||
|
||||
b.Navigation("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ConsignmentProduct", b =>
|
||||
{
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Consignment", "Consignment")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("ConsignmentID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Consignment");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Seller", "Seller")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("OrderID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Seller");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.PC", b =>
|
||||
{
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Employee", "Employee")
|
||||
.WithMany("PCs")
|
||||
.HasForeignKey("EmployeeID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Employee");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Employee", "Employee")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("EmployeeID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Employee");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("ConsignmentComponents")
|
||||
.HasForeignKey("ComponentID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("ProductID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("_requests")
|
||||
.HasForeignKey("OrderID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.RequestComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("RequestComponents")
|
||||
.HasForeignKey("ComponentID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.PC", "PC")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("PCID");
|
||||
|
||||
b.HasOne("ComputerStoreDatabaseImplement.Models.Request", "Request")
|
||||
.WithMany("PCs")
|
||||
.HasForeignKey("RequestID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("PC");
|
||||
|
||||
b.Navigation("Request");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("ConsignmentComponents");
|
||||
|
||||
b.Navigation("RequestComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Consignment", b =>
|
||||
{
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Employee", b =>
|
||||
{
|
||||
b.Navigation("PCs");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Navigation("_consignments");
|
||||
|
||||
b.Navigation("_requests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.PC", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Consignments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Navigation("PCs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Seller", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerStoreDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class fieldFixes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RequestComponents_PCs_PCID",
|
||||
table: "RequestComponents");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "PCID",
|
||||
table: "RequestComponents",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RequestComponents_PCs_PCID",
|
||||
table: "RequestComponents",
|
||||
column: "PCID",
|
||||
principalTable: "PCs",
|
||||
principalColumn: "ID");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RequestComponents_PCs_PCID",
|
||||
table: "RequestComponents");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "PCID",
|
||||
table: "RequestComponents",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RequestComponents_PCs_PCID",
|
||||
table: "RequestComponents",
|
||||
column: "PCID",
|
||||
principalTable: "PCs",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user