Compare commits
No commits in common. "0ac9228a418abed5dc33cfa187715b080b114187" and "d04752b2badefdf1c93b2613de4f3c8d3f59aa73" have entirely different histories.
0ac9228a41
...
d04752b2ba
@ -35,10 +35,6 @@ Global
|
||||
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -8,6 +8,5 @@ namespace ComputerHardwareStoreContracts.BindingModels
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new();
|
||||
public IStoreKeeperModel StoreKeeper { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,5 @@ namespace ComputerHardwareStoreContracts.ViewModels
|
||||
[DisplayName("Цена")]
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new();
|
||||
public IStoreKeeperModel StoreKeeper { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
{
|
||||
string Name { get; }
|
||||
double Price { get; }
|
||||
public IStoreKeeperModel StoreKeeper { get; }
|
||||
int StoreKeeperId { get; }
|
||||
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,547 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ComputerHardwareStoreDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(ComputerHardwareStoreDBContext))]
|
||||
[Migration("20240501130816_fix")]
|
||||
partial class fix
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("VendorId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VendorId");
|
||||
|
||||
b.ToTable("Builds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BuildId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BuildId");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.ToTable("BuildComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BuildId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Text")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BuildId");
|
||||
|
||||
b.ToTable("Comments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StoreKeeperId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StoreKeeperId");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("OrderProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int?>("StoreKeeperId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StoreKeeperId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("ProductComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("VendorId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VendorId");
|
||||
|
||||
b.ToTable("Purchases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BuildId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("PurchaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BuildId");
|
||||
|
||||
b.HasIndex("PurchaseId");
|
||||
|
||||
b.ToTable("PurchaseBuilds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("PurchaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("PurchaseId");
|
||||
|
||||
b.ToTable("PurchaseProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("StoreKeepers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Vendors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", "Vendor")
|
||||
.WithMany("Builds")
|
||||
.HasForeignKey("VendorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vendor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("BuildId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Build");
|
||||
|
||||
b.Navigation("Component");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||
.WithMany()
|
||||
.HasForeignKey("BuildId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Build");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", "StoreKeeperЗЛ")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("StoreKeeperId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("StoreKeeperЗЛ");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", null)
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("StoreKeeperId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("ProductComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", null)
|
||||
.WithMany("Purchases")
|
||||
.HasForeignKey("VendorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||
.WithMany()
|
||||
.HasForeignKey("BuildId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||
.WithMany("Builds")
|
||||
.HasForeignKey("PurchaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Build");
|
||||
|
||||
b.Navigation("Purchase");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("PurchaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Product");
|
||||
|
||||
b.Navigation("Purchase");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("ProductComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||
{
|
||||
b.Navigation("Builds");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||
{
|
||||
b.Navigation("Builds");
|
||||
|
||||
b.Navigation("Purchases");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class fix : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Orders_Products_ProductId",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Orders_ProductId",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Count",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProductId",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Comments_BuildId",
|
||||
table: "Comments",
|
||||
column: "BuildId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Comments_Builds_BuildId",
|
||||
table: "Comments",
|
||||
column: "BuildId",
|
||||
principalTable: "Builds",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Comments_Builds_BuildId",
|
||||
table: "Comments");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Comments_BuildId",
|
||||
table: "Comments");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Count",
|
||||
table: "Orders",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ProductId",
|
||||
table: "Orders",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_ProductId",
|
||||
table: "Orders",
|
||||
column: "ProductId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Orders_Products_ProductId",
|
||||
table: "Orders",
|
||||
column: "ProductId",
|
||||
principalTable: "Products",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,544 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ComputerHardwareStoreDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(ComputerHardwareStoreDBContext))]
|
||||
partial class ComputerHardwareStoreDBContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("VendorId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VendorId");
|
||||
|
||||
b.ToTable("Builds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BuildId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BuildId");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.ToTable("BuildComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BuildId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Text")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BuildId");
|
||||
|
||||
b.ToTable("Comments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StoreKeeperId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StoreKeeperId");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("OrderProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int?>("StoreKeeperId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StoreKeeperId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("ProductComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("VendorId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VendorId");
|
||||
|
||||
b.ToTable("Purchases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BuildId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("PurchaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BuildId");
|
||||
|
||||
b.HasIndex("PurchaseId");
|
||||
|
||||
b.ToTable("PurchaseBuilds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("PurchaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("PurchaseId");
|
||||
|
||||
b.ToTable("PurchaseProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("StoreKeepers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Vendors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", "Vendor")
|
||||
.WithMany("Builds")
|
||||
.HasForeignKey("VendorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vendor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("BuildId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Build");
|
||||
|
||||
b.Navigation("Component");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||
.WithMany()
|
||||
.HasForeignKey("BuildId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Build");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", "StoreKeeperЗЛ")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("StoreKeeperId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("StoreKeeperЗЛ");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", null)
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("StoreKeeperId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("ProductComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", null)
|
||||
.WithMany("Purchases")
|
||||
.HasForeignKey("VendorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||
.WithMany()
|
||||
.HasForeignKey("BuildId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||
.WithMany("Builds")
|
||||
.HasForeignKey("PurchaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Build");
|
||||
|
||||
b.Navigation("Purchase");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||
{
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("PurchaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Product");
|
||||
|
||||
b.Navigation("Purchase");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("ProductComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||
{
|
||||
b.Navigation("Builds");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||
{
|
||||
b.Navigation("Builds");
|
||||
|
||||
b.Navigation("Purchases");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,6 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
|
||||
public string Text { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public int BuildId { get; set; }
|
||||
public virtual Build Build { get; set; } = new();
|
||||
public static Comment? Create(CommentBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
|
@ -14,9 +14,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public double Price { get; set; }
|
||||
[NotMapped]
|
||||
IStoreKeeperModel IProductModel.StoreKeeper => StoreKeeper;
|
||||
public virtual StoreKeeper StoreKeeper {get; set;} = new();
|
||||
public int StoreKeeperId { get; private set; }
|
||||
private Dictionary<int, (IComponentModel, int)>? _productComponents = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, (IComponentModel, int)> ProductComponents
|
||||
@ -64,8 +62,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Price = Price,
|
||||
ProductComponents = ProductComponents,
|
||||
StoreKeeper = StoreKeeper,
|
||||
ProductComponents = ProductComponents
|
||||
};
|
||||
|
||||
public static void UpdateComponents(ComputerHardwareStoreDBContext context, ProductBindingModel model)
|
||||
|
@ -1,26 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ComputerHardwareStoreDatabaseImplement\ComputerHardwareStoreDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,87 +0,0 @@
|
||||
using ComputerHardwareStoreContracts.BindingModels;
|
||||
using ComputerHardwareStoreContracts.SearchModels;
|
||||
using ComputerHardwareStoreContracts.StorageContracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ComputerHardwareStoreREST.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class BuildController : Controller
|
||||
{
|
||||
private readonly ILogger<BuildController> _logger;
|
||||
private readonly IBuildStorage _storage;
|
||||
|
||||
public BuildController(ILogger<BuildController> logger, IBuildStorage storage)
|
||||
{
|
||||
_logger = logger;
|
||||
_storage = storage;
|
||||
}
|
||||
|
||||
[HttpPost("get/filter")]
|
||||
public IActionResult GetByFilter([FromBody] BuildSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetFilteredList(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("get")]
|
||||
public IActionResult GetById([FromBody] BuildSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetElement(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("create")]
|
||||
public IActionResult Create([FromBody] BuildBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Insert(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPut("update")]
|
||||
public IActionResult Update([FromBody] BuildBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Update(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("delete")]
|
||||
public IActionResult Delete([FromBody] BuildBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Delete(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
using ComputerHardwareStoreContracts.BindingModels;
|
||||
using ComputerHardwareStoreContracts.SearchModels;
|
||||
using ComputerHardwareStoreContracts.StorageContracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ComputerHardwareStoreREST.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class CommentController : Controller
|
||||
{
|
||||
private readonly ILogger<CommentController> _logger;
|
||||
private readonly ICommentStorage _storage;
|
||||
|
||||
public CommentController(ILogger<CommentController> logger, ICommentStorage storage)
|
||||
{
|
||||
_logger = logger;
|
||||
_storage = storage;
|
||||
}
|
||||
|
||||
[HttpPost("get/filter")]
|
||||
public IActionResult GetByFilter([FromBody] CommentSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetFilteredList(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("get")]
|
||||
public IActionResult GetById([FromBody] CommentSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetElement(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("create")]
|
||||
public IActionResult Create([FromBody] CommentBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Insert(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPut("update")]
|
||||
public IActionResult Update([FromBody] CommentBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Update(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("delete")]
|
||||
public IActionResult Delete([FromBody] CommentBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Delete(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
using ComputerHardwareStoreContracts.BindingModels;
|
||||
using ComputerHardwareStoreContracts.SearchModels;
|
||||
using ComputerHardwareStoreContracts.StorageContracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ComputerHardwareStoreREST.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class OrderController : Controller
|
||||
{
|
||||
private readonly ILogger<OrderController> _logger;
|
||||
private readonly IOrderStorage _storage;
|
||||
|
||||
public OrderController(ILogger<OrderController> logger, IOrderStorage storage)
|
||||
{
|
||||
_logger = logger;
|
||||
_storage = storage;
|
||||
}
|
||||
|
||||
[HttpPost("get/filter")]
|
||||
public IActionResult GetByFilter([FromBody] OrderSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetFilteredList(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("get")]
|
||||
public IActionResult GetById([FromBody] OrderSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetElement(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("create")]
|
||||
public IActionResult Create([FromBody] OrderBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Insert(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPut("update")]
|
||||
public IActionResult Update([FromBody] OrderBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Update(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("delete")]
|
||||
public IActionResult Delete([FromBody] OrderBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Delete(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
using ComputerHardwareStoreContracts.BindingModels;
|
||||
using ComputerHardwareStoreContracts.SearchModels;
|
||||
using ComputerHardwareStoreContracts.StorageContracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ComputerHardwareStoreREST.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class ProductController : Controller
|
||||
{
|
||||
private readonly ILogger<ProductController> _logger;
|
||||
private readonly IProductStorage _storage;
|
||||
|
||||
public ProductController(ILogger<ProductController> logger, IProductStorage storage)
|
||||
{
|
||||
_logger = logger;
|
||||
_storage = storage;
|
||||
}
|
||||
|
||||
[HttpPost("get/filter")]
|
||||
public IActionResult GetByFilter([FromBody] ProductSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetFilteredList(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("get")]
|
||||
public IActionResult GetById([FromBody] ProductSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetElement(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("create")]
|
||||
public IActionResult Create([FromBody] ProductBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Insert(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPut("update")]
|
||||
public IActionResult Update([FromBody] ProductBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Update(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("delete")]
|
||||
public IActionResult Delete([FromBody] ProductBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Delete(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
using ComputerHardwareStoreContracts.BindingModels;
|
||||
using ComputerHardwareStoreContracts.SearchModels;
|
||||
using ComputerHardwareStoreContracts.StorageContracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ComputerHardwareStoreREST.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class PurchaseController : Controller
|
||||
{
|
||||
private readonly ILogger<PurchaseController> _logger;
|
||||
private readonly IPurchaseStorage _storage;
|
||||
|
||||
public PurchaseController(ILogger<PurchaseController> logger, IPurchaseStorage storage)
|
||||
{
|
||||
_logger = logger;
|
||||
_storage = storage;
|
||||
}
|
||||
|
||||
[HttpPost("get/filter")]
|
||||
public IActionResult GetByFilter([FromBody] PurchaseSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetFilteredList(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("get")]
|
||||
public IActionResult GetById([FromBody] PurchaseSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetElement(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("create")]
|
||||
public IActionResult Create([FromBody] PurchaseBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Insert(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPut("update")]
|
||||
public IActionResult Update([FromBody] PurchaseBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Update(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("delete")]
|
||||
public IActionResult Delete([FromBody] PurchaseBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Delete(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ComputerHardwareStoreContracts.BindingModels;
|
||||
using ComputerHardwareStoreContracts.SearchModels;
|
||||
using ComputerHardwareStoreContracts.StorageContracts;
|
||||
|
||||
namespace ComputerHardwareStoreREST.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class StoreKeepersController : Controller
|
||||
{
|
||||
private readonly ILogger<StoreKeepersController> _logger;
|
||||
private readonly IStoreKeeperStorage _storage;
|
||||
|
||||
public StoreKeepersController(ILogger<StoreKeepersController> logger, IStoreKeeperStorage storage)
|
||||
{
|
||||
_logger = logger;
|
||||
_storage = storage;
|
||||
}
|
||||
|
||||
[HttpPost("get/filter")]
|
||||
public IActionResult GetByFilter([FromBody] StoreKeeperSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetFilteredList(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("get")]
|
||||
public IActionResult GetById([FromBody] StoreKeeperSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetElement(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("create")]
|
||||
public IActionResult Create([FromBody] StoreKeeperBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Insert(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPut("update")]
|
||||
public IActionResult Update([FromBody] StoreKeeperBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Update(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("delete")]
|
||||
public IActionResult Delete([FromBody] StoreKeeperBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Delete(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
using ComputerHardwareStoreContracts.BindingModels;
|
||||
using ComputerHardwareStoreContracts.SearchModels;
|
||||
using ComputerHardwareStoreContracts.StorageContracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ComputerHardwareStoreREST.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class VendorController : Controller
|
||||
{
|
||||
private readonly ILogger<VendorController> _logger;
|
||||
private readonly IVendorStorage _storage;
|
||||
|
||||
public VendorController(ILogger<VendorController> logger, IVendorStorage storage)
|
||||
{
|
||||
_logger = logger;
|
||||
_storage = storage;
|
||||
}
|
||||
|
||||
[HttpPost("get/filter")]
|
||||
public IActionResult GetByFilter([FromBody] VendorSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetFilteredList(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("get")]
|
||||
public IActionResult GetById([FromBody] VendorSearchModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.GetElement(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("create")]
|
||||
public IActionResult Create([FromBody] VendorBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Insert(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPut("update")]
|
||||
public IActionResult Update([FromBody] VendorBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Update(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
[HttpPost("delete")]
|
||||
public IActionResult Delete([FromBody] VendorBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _storage.Delete(model);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
using ComputerHardwareStoreContracts.StorageContracts;
|
||||
using ComputerHardwareStoreDatabaseImplement;
|
||||
using ComputerHardwareStoreDatabaseImplement.Implements;
|
||||
using ComputerHardwareStoreREST;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
// получаем строку подключения из файла конфигурации
|
||||
//DBSetting.ConectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||
|
||||
builder.Services.AddSingleton<IComponentStorage, ComponentStorage >();
|
||||
builder.Services.AddSingleton<IStoreKeeperStorage, StoreKeeperStorage>();
|
||||
builder.Services.AddSingleton<IProductStorage, ProductStorage>();
|
||||
builder.Services.AddSingleton<IOrderStorage, OrderStorage>();
|
||||
builder.Services.AddSingleton<IBuildStorage, BuildStorage>();
|
||||
builder.Services.AddSingleton<ICommentStorage, CommentStorage>();
|
||||
builder.Services.AddSingleton<IPurchaseStorage, PurchaseStorage>();
|
||||
builder.Services.AddSingleton<IVendorStorage, VendorStorage>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
@ -1,18 +0,0 @@
|
||||
<environment names="Development">
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.17.0/jquery.validate.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-rZfj/ogBloos6wzLGpPkkOr/gpkBNLZ6b6yLy4o+ok+t/SAKlL5mvXLr0OXNi1Hp">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.9/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-ifv0TYDWxBHzvAk2Z0n8R434FL1Rlv/Av18DXE43N/1rvHyOG4izKst0f2iSLdds">
|
||||
</script>
|
||||
</environment>
|
@ -1,43 +0,0 @@
|
||||
@model ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Create";
|
||||
}
|
||||
|
||||
<h1>Create</h1>
|
||||
|
||||
<h4>StoreKeeper</h4>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Create">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Name" class="control-label"></label>
|
||||
<input asp-for="Name" class="form-control" />
|
||||
<span asp-validation-for="Name" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Login" class="control-label"></label>
|
||||
<input asp-for="Login" class="form-control" />
|
||||
<span asp-validation-for="Login" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Password" class="control-label"></label>
|
||||
<input asp-for="Password" class="form-control" />
|
||||
<span asp-validation-for="Password" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Create" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
@model ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Delete";
|
||||
}
|
||||
|
||||
<h1>Delete</h1>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>StoreKeeper</h4>
|
||||
<hr />
|
||||
<dl class="row">
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Name)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Login)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Login)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Password)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Password)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<form asp-action="Delete">
|
||||
<input type="hidden" asp-for="Id" />
|
||||
<input type="submit" value="Delete" class="btn btn-danger" /> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</form>
|
||||
</div>
|
@ -1,36 +0,0 @@
|
||||
@model ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Details";
|
||||
}
|
||||
|
||||
<h1>Details</h1>
|
||||
|
||||
<div>
|
||||
<h4>StoreKeeper</h4>
|
||||
<hr />
|
||||
<dl class="row">
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Name)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Login)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Login)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Password)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Password)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div>
|
||||
<a asp-action="Edit" asp-route-id="@Model?.Id">Edit</a> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
@ -1,44 +0,0 @@
|
||||
@model ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Edit";
|
||||
}
|
||||
|
||||
<h1>Edit</h1>
|
||||
|
||||
<h4>StoreKeeper</h4>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Edit">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<input type="hidden" asp-for="Id" />
|
||||
<div class="form-group">
|
||||
<label asp-for="Name" class="control-label"></label>
|
||||
<input asp-for="Name" class="form-control" />
|
||||
<span asp-validation-for="Name" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Login" class="control-label"></label>
|
||||
<input asp-for="Login" class="form-control" />
|
||||
<span asp-validation-for="Login" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Password" class="control-label"></label>
|
||||
<input asp-for="Password" class="form-control" />
|
||||
<span asp-validation-for="Password" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Save" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
@model IEnumerable<ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Index";
|
||||
}
|
||||
|
||||
<h1>Index</h1>
|
||||
|
||||
<p>
|
||||
<a asp-action="Create">Create New</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Login)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Password)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Login)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Password)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
|
||||
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
|
||||
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
Loading…
Reference in New Issue
Block a user