Upload project.
This commit is contained in:
10
ThAmCo-Products/ThAmCo.Products/Data/Brand.cs
Normal file
10
ThAmCo-Products/ThAmCo.Products/Data/Brand.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace ThAmCo.Products.Data
|
||||
{
|
||||
public class Brand
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public int AvailableProductCount { get; set; }
|
||||
}
|
||||
}
|
||||
9
ThAmCo-Products/ThAmCo.Products/Data/Category.cs
Normal file
9
ThAmCo-Products/ThAmCo.Products/Data/Category.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace ThAmCo.Products.Data
|
||||
{
|
||||
public class Category
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int AvailableProductCount { get; set; }
|
||||
}
|
||||
}
|
||||
88
ThAmCo-Products/ThAmCo.Products/Data/Migrations/20191105145333_InitialCreate.Designer.cs
generated
Normal file
88
ThAmCo-Products/ThAmCo.Products/Data/Migrations/20191105145333_InitialCreate.Designer.cs
generated
Normal file
@@ -0,0 +1,88 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ThAmCo.Products.Data;
|
||||
|
||||
namespace ThAmCo.Products.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ProductsDbContext))]
|
||||
[Migration("20191105145333_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Brand", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Brands");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Category", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Category");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<bool>("Active");
|
||||
|
||||
b.Property<int?>("BrandId");
|
||||
|
||||
b.Property<int?>("CategoryId");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BrandId");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Product", b =>
|
||||
{
|
||||
b.HasOne("ThAmCo.Products.Data.Brand", "Brand")
|
||||
.WithMany()
|
||||
.HasForeignKey("BrandId");
|
||||
|
||||
b.HasOne("ThAmCo.Products.Data.Category", "Category")
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoryId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ThAmCo.Products.Data.Migrations
|
||||
{
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Brands",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Brands", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Category",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Category", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Products",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Description = table.Column<string>(nullable: true),
|
||||
BrandId = table.Column<int>(nullable: true),
|
||||
CategoryId = table.Column<int>(nullable: true),
|
||||
Active = table.Column<bool>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Products", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Products_Brands_BrandId",
|
||||
column: x => x.BrandId,
|
||||
principalTable: "Brands",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Products_Category_CategoryId",
|
||||
column: x => x.CategoryId,
|
||||
principalTable: "Category",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Products_BrandId",
|
||||
table: "Products",
|
||||
column: "BrandId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Products_CategoryId",
|
||||
table: "Products",
|
||||
column: "CategoryId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Products");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Brands");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Category");
|
||||
}
|
||||
}
|
||||
}
|
||||
188
ThAmCo-Products/ThAmCo.Products/Data/Migrations/20191107105050_InitialProductTestData.Designer.cs
generated
Normal file
188
ThAmCo-Products/ThAmCo.Products/Data/Migrations/20191107105050_InitialProductTestData.Designer.cs
generated
Normal file
@@ -0,0 +1,188 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ThAmCo.Products.Data;
|
||||
|
||||
namespace ThAmCo.Products.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ProductsDbContext))]
|
||||
[Migration("20191107105050_InitialProductTestData")]
|
||||
partial class InitialProductTestData
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Brand", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Brands");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Brand 1"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Name = "Brand 2"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
Name = "Brand 3"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Category", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Category");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Category 1"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Name = "Category 2"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
Name = "Category 3"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<bool>("Active");
|
||||
|
||||
b.Property<int>("BrandId");
|
||||
|
||||
b.Property<int>("CategoryId");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BrandId");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.ToTable("Products");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Active = true,
|
||||
BrandId = 1,
|
||||
CategoryId = 2,
|
||||
Description = "Description of product 1.",
|
||||
Name = "Product 1"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Active = true,
|
||||
BrandId = 2,
|
||||
CategoryId = 3,
|
||||
Description = "Description of product 2.",
|
||||
Name = "Product 2"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
Active = true,
|
||||
BrandId = 3,
|
||||
CategoryId = 1,
|
||||
Description = "Description of product 3.",
|
||||
Name = "Product 3"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
Active = true,
|
||||
BrandId = 1,
|
||||
CategoryId = 2,
|
||||
Description = "Description of product 4.",
|
||||
Name = "Product 4"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5,
|
||||
Active = true,
|
||||
BrandId = 2,
|
||||
CategoryId = 3,
|
||||
Description = "Description of product 5.",
|
||||
Name = "Product 5"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 6,
|
||||
Active = true,
|
||||
BrandId = 3,
|
||||
CategoryId = 1,
|
||||
Description = "Description of product 6.",
|
||||
Name = "Product 6"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 7,
|
||||
Active = true,
|
||||
BrandId = 1,
|
||||
CategoryId = 2,
|
||||
Description = "Description of product 7.",
|
||||
Name = "Product 7"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Product", b =>
|
||||
{
|
||||
b.HasOne("ThAmCo.Products.Data.Brand", "Brand")
|
||||
.WithMany()
|
||||
.HasForeignKey("BrandId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("ThAmCo.Products.Data.Category", "Category")
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ThAmCo.Products.Data.Migrations
|
||||
{
|
||||
public partial class InitialProductTestData : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Products_Brands_BrandId",
|
||||
table: "Products");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Products_Category_CategoryId",
|
||||
table: "Products");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "CategoryId",
|
||||
table: "Products",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "BrandId",
|
||||
table: "Products",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Brands",
|
||||
columns: new[] { "Id", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "Brand 1" },
|
||||
{ 2, "Brand 2" },
|
||||
{ 3, "Brand 3" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Category",
|
||||
columns: new[] { "Id", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "Category 1" },
|
||||
{ 2, "Category 2" },
|
||||
{ 3, "Category 3" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Products",
|
||||
columns: new[] { "Id", "Active", "BrandId", "CategoryId", "Description", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 3, true, 3, 1, "Description of product 3.", "Product 3" },
|
||||
{ 6, true, 3, 1, "Description of product 6.", "Product 6" },
|
||||
{ 1, true, 1, 2, "Description of product 1.", "Product 1" },
|
||||
{ 4, true, 1, 2, "Description of product 4.", "Product 4" },
|
||||
{ 7, true, 1, 2, "Description of product 7.", "Product 7" },
|
||||
{ 2, true, 2, 3, "Description of product 2.", "Product 2" },
|
||||
{ 5, true, 2, 3, "Description of product 5.", "Product 5" }
|
||||
});
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Products_Brands_BrandId",
|
||||
table: "Products",
|
||||
column: "BrandId",
|
||||
principalTable: "Brands",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Products_Category_CategoryId",
|
||||
table: "Products",
|
||||
column: "CategoryId",
|
||||
principalTable: "Category",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Products_Brands_BrandId",
|
||||
table: "Products");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Products_Category_CategoryId",
|
||||
table: "Products");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Products",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Products",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Products",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Products",
|
||||
keyColumn: "Id",
|
||||
keyValue: 4);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Products",
|
||||
keyColumn: "Id",
|
||||
keyValue: 5);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Products",
|
||||
keyColumn: "Id",
|
||||
keyValue: 6);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Products",
|
||||
keyColumn: "Id",
|
||||
keyValue: 7);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Brands",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Brands",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Brands",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Category",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Category",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Category",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "CategoryId",
|
||||
table: "Products",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int));
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "BrandId",
|
||||
table: "Products",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int));
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Products_Brands_BrandId",
|
||||
table: "Products",
|
||||
column: "BrandId",
|
||||
principalTable: "Brands",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Products_Category_CategoryId",
|
||||
table: "Products",
|
||||
column: "CategoryId",
|
||||
principalTable: "Category",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
||||
203
ThAmCo-Products/ThAmCo.Products/Data/Migrations/20191223014356_NewBrandAndCategoryObjects.Designer.cs
generated
Normal file
203
ThAmCo-Products/ThAmCo.Products/Data/Migrations/20191223014356_NewBrandAndCategoryObjects.Designer.cs
generated
Normal file
@@ -0,0 +1,203 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ThAmCo.Products.Data;
|
||||
|
||||
namespace ThAmCo.Products.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ProductsDbContext))]
|
||||
[Migration("20191223014356_NewBrandAndCategoryObjects")]
|
||||
partial class NewBrandAndCategoryObjects
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Brand", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("AvailableProductCount");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Brands");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
AvailableProductCount = 3,
|
||||
Description = "Description 1",
|
||||
Name = "Brand 1"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
AvailableProductCount = 2,
|
||||
Description = "Description 2",
|
||||
Name = "Brand 2"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
AvailableProductCount = 3,
|
||||
Description = "Description 3",
|
||||
Name = "Brand 3"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Category", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("AvailableProductCount");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Category");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
AvailableProductCount = 4,
|
||||
Name = "Category 1"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
AvailableProductCount = 3,
|
||||
Name = "Category 2"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
AvailableProductCount = 2,
|
||||
Name = "Category 3"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<bool>("Active");
|
||||
|
||||
b.Property<int>("BrandId");
|
||||
|
||||
b.Property<int>("CategoryId");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BrandId");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.ToTable("Products");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Active = true,
|
||||
BrandId = 1,
|
||||
CategoryId = 2,
|
||||
Description = "Description of product 1.",
|
||||
Name = "Product 1"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Active = true,
|
||||
BrandId = 2,
|
||||
CategoryId = 3,
|
||||
Description = "Description of product 2.",
|
||||
Name = "Product 2"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
Active = true,
|
||||
BrandId = 3,
|
||||
CategoryId = 1,
|
||||
Description = "Description of product 3.",
|
||||
Name = "Product 3"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
Active = true,
|
||||
BrandId = 1,
|
||||
CategoryId = 2,
|
||||
Description = "Description of product 4.",
|
||||
Name = "Product 4"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5,
|
||||
Active = true,
|
||||
BrandId = 2,
|
||||
CategoryId = 3,
|
||||
Description = "Description of product 5.",
|
||||
Name = "Product 5"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 6,
|
||||
Active = true,
|
||||
BrandId = 3,
|
||||
CategoryId = 1,
|
||||
Description = "Description of product 6.",
|
||||
Name = "Product 6"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 7,
|
||||
Active = true,
|
||||
BrandId = 1,
|
||||
CategoryId = 2,
|
||||
Description = "Description of product 7.",
|
||||
Name = "Product 7"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Product", b =>
|
||||
{
|
||||
b.HasOne("ThAmCo.Products.Data.Brand", "Brand")
|
||||
.WithMany()
|
||||
.HasForeignKey("BrandId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("ThAmCo.Products.Data.Category", "Category")
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ThAmCo.Products.Data.Migrations
|
||||
{
|
||||
public partial class NewBrandAndCategoryObjects : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "AvailableProductCount",
|
||||
table: "Category",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "AvailableProductCount",
|
||||
table: "Brands",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Description",
|
||||
table: "Brands",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Brands",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
columns: new[] { "AvailableProductCount", "Description" },
|
||||
values: new object[] { 3, "Description 1" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Brands",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
columns: new[] { "AvailableProductCount", "Description" },
|
||||
values: new object[] { 2, "Description 2" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Brands",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
columns: new[] { "AvailableProductCount", "Description" },
|
||||
values: new object[] { 3, "Description 3" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Category",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "AvailableProductCount",
|
||||
value: 4);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Category",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "AvailableProductCount",
|
||||
value: 3);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Category",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "AvailableProductCount",
|
||||
value: 2);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AvailableProductCount",
|
||||
table: "Category");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AvailableProductCount",
|
||||
table: "Brands");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Description",
|
||||
table: "Brands");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ThAmCo.Products.Data;
|
||||
|
||||
namespace ThAmCo.Products.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ProductsDbContext))]
|
||||
partial class ProductsDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Brand", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("AvailableProductCount");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Brands");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
AvailableProductCount = 3,
|
||||
Description = "Description 1",
|
||||
Name = "Brand 1"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
AvailableProductCount = 2,
|
||||
Description = "Description 2",
|
||||
Name = "Brand 2"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
AvailableProductCount = 3,
|
||||
Description = "Description 3",
|
||||
Name = "Brand 3"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Category", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("AvailableProductCount");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Category");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
AvailableProductCount = 4,
|
||||
Name = "Category 1"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
AvailableProductCount = 3,
|
||||
Name = "Category 2"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
AvailableProductCount = 2,
|
||||
Name = "Category 3"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<bool>("Active");
|
||||
|
||||
b.Property<int>("BrandId");
|
||||
|
||||
b.Property<int>("CategoryId");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BrandId");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.ToTable("Products");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Active = true,
|
||||
BrandId = 1,
|
||||
CategoryId = 2,
|
||||
Description = "Description of product 1.",
|
||||
Name = "Product 1"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Active = true,
|
||||
BrandId = 2,
|
||||
CategoryId = 3,
|
||||
Description = "Description of product 2.",
|
||||
Name = "Product 2"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
Active = true,
|
||||
BrandId = 3,
|
||||
CategoryId = 1,
|
||||
Description = "Description of product 3.",
|
||||
Name = "Product 3"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
Active = true,
|
||||
BrandId = 1,
|
||||
CategoryId = 2,
|
||||
Description = "Description of product 4.",
|
||||
Name = "Product 4"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5,
|
||||
Active = true,
|
||||
BrandId = 2,
|
||||
CategoryId = 3,
|
||||
Description = "Description of product 5.",
|
||||
Name = "Product 5"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 6,
|
||||
Active = true,
|
||||
BrandId = 3,
|
||||
CategoryId = 1,
|
||||
Description = "Description of product 6.",
|
||||
Name = "Product 6"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 7,
|
||||
Active = true,
|
||||
BrandId = 1,
|
||||
CategoryId = 2,
|
||||
Description = "Description of product 7.",
|
||||
Name = "Product 7"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ThAmCo.Products.Data.Product", b =>
|
||||
{
|
||||
b.HasOne("ThAmCo.Products.Data.Brand", "Brand")
|
||||
.WithMany()
|
||||
.HasForeignKey("BrandId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("ThAmCo.Products.Data.Category", "Category")
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
14
ThAmCo-Products/ThAmCo.Products/Data/Product.cs
Normal file
14
ThAmCo-Products/ThAmCo.Products/Data/Product.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace ThAmCo.Products.Data
|
||||
{
|
||||
public class Product
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public int BrandId { get; set; }
|
||||
public Brand Brand { get; set; }
|
||||
public int CategoryId { get; set; }
|
||||
public Category Category { get; set; }
|
||||
public bool Active { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ThAmCo.Products.Data.ProductsContext
|
||||
{
|
||||
public interface IProductsContext
|
||||
{
|
||||
Task<IEnumerable<Product>> GetAll();
|
||||
Task<IEnumerable<Product>> GetAllActive();
|
||||
Task<Product> GetProductAsync(int id);
|
||||
void AddProductAsync(Product product);
|
||||
void SoftDeleteProductAsync(Product product = null, int? id = null);
|
||||
Task<IEnumerable<Brand>> GetBrandsAsync();
|
||||
Task<IEnumerable<Category>> GetCategoriesAsync();
|
||||
void SaveAndUpdateContext();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ThAmCo.Products.Data.ProductsContext
|
||||
{
|
||||
public class MockProductsContext : IProductsContext
|
||||
{
|
||||
private readonly List<Product> _products;
|
||||
private List<Brand> _brands;
|
||||
private List<Category> _categories;
|
||||
|
||||
public MockProductsContext(List<Product> products, List<Brand> brands, List<Category> categories)
|
||||
{
|
||||
_products = products;
|
||||
_brands = brands;
|
||||
_categories = categories;
|
||||
}
|
||||
|
||||
public Task<IEnumerable<Product>> GetAll()
|
||||
{
|
||||
return Task.FromResult(_products.AsEnumerable());
|
||||
}
|
||||
|
||||
public Task<IEnumerable<Product>> GetAllActive()
|
||||
{
|
||||
return Task.FromResult(_products.Where(p => p.Active));
|
||||
}
|
||||
|
||||
public Task<Product> GetProductAsync(int id)
|
||||
{
|
||||
return Task.FromResult(_products.FirstOrDefault(p => p.Id == id));
|
||||
}
|
||||
|
||||
public void AddProductAsync(Product product)
|
||||
{
|
||||
_products.Add(product);
|
||||
}
|
||||
|
||||
public void SoftDeleteProductAsync(Product product = null, int? id = null)
|
||||
{
|
||||
var chosenId = 0;
|
||||
if (product == null && id != null)
|
||||
chosenId = id ?? 0;
|
||||
if (product != null && id == null)
|
||||
chosenId = product.Id;
|
||||
var productFromList = _products.FirstOrDefault(p => p.Id == chosenId);
|
||||
if (productFromList != null)
|
||||
{
|
||||
_products.Remove(product);
|
||||
_products.Add(product);
|
||||
}
|
||||
}
|
||||
|
||||
public Task<IEnumerable<Brand>> GetBrandsAsync()
|
||||
{
|
||||
return Task.FromResult(_brands.AsEnumerable());
|
||||
}
|
||||
|
||||
public Task<IEnumerable<Category>> GetCategoriesAsync()
|
||||
{
|
||||
return Task.FromResult(_categories.AsEnumerable());
|
||||
}
|
||||
|
||||
public void SaveAndUpdateContext()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ThAmCo.Products.Data.ProductsContext
|
||||
{
|
||||
public class ProductsContext : IProductsContext
|
||||
{
|
||||
private readonly ProductsDbContext _context;
|
||||
|
||||
public ProductsContext(ProductsDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Product>> GetAll()
|
||||
{
|
||||
return await _context.Products.Include(p => p.Category).Include(p => p.Brand).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Product>> GetAllActive()
|
||||
{
|
||||
return await _context.Products.Where(p => p.Active).Include(p => p.Category).Include(p => p.Brand).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Product> GetProductAsync(int id)
|
||||
{
|
||||
return await _context.Products.FirstOrDefaultAsync(p => p.Id == id);
|
||||
}
|
||||
|
||||
public void AddProductAsync(Product product)
|
||||
{
|
||||
_context.Add(product);
|
||||
SaveAndUpdateContext();
|
||||
}
|
||||
|
||||
public async void SoftDeleteProductAsync(Product product = null, int? id = null)
|
||||
{
|
||||
if (product != null)
|
||||
{
|
||||
product.Active = false;
|
||||
_context.Update(product);
|
||||
SaveAndUpdateContext();
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == null || id <= 0) return;
|
||||
var productToChange = await _context.Products.FirstOrDefaultAsync(p => p.Id == id);
|
||||
if (productToChange != null)
|
||||
{
|
||||
productToChange.Active = false;
|
||||
_context.Update(productToChange);
|
||||
SaveAndUpdateContext();
|
||||
}
|
||||
}
|
||||
|
||||
public Task<IEnumerable<Brand>> GetBrandsAsync()
|
||||
{
|
||||
return Task.FromResult(_context.Brands.AsEnumerable());
|
||||
}
|
||||
|
||||
public Task<IEnumerable<Category>> GetCategoriesAsync()
|
||||
{
|
||||
return Task.FromResult(_context.Category.AsEnumerable());
|
||||
}
|
||||
|
||||
public async void SaveAndUpdateContext()
|
||||
{
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
72
ThAmCo-Products/ThAmCo.Products/Data/ProductsDbContext.cs
Normal file
72
ThAmCo-Products/ThAmCo.Products/Data/ProductsDbContext.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ThAmCo.Products.Data
|
||||
{
|
||||
public class ProductsDbContext : DbContext
|
||||
{
|
||||
public DbSet<Product> Products { get; set; }
|
||||
public DbSet<Brand> Brands { get; set; }
|
||||
public DbSet<Category> Category { get; set; }
|
||||
|
||||
private IHostingEnvironment HostEnv { get; }
|
||||
|
||||
public ProductsDbContext(DbContextOptions<ProductsDbContext> options, IHostingEnvironment env) : base(options)
|
||||
{
|
||||
HostEnv = env;
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder builder)
|
||||
{
|
||||
base.OnConfiguring(builder);
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
builder.Entity<Brand>()
|
||||
.HasKey(b => b.Id);
|
||||
|
||||
builder.Entity<Category>()
|
||||
.HasKey(c => c.Id);
|
||||
|
||||
builder.Entity<Product>()
|
||||
.HasOne(b => b.Brand);
|
||||
|
||||
builder.Entity<Product>()
|
||||
.HasOne(c => c.Category);
|
||||
|
||||
builder.Entity<Product>()
|
||||
.HasKey(p => p.Id);
|
||||
|
||||
if (HostEnv != null && HostEnv.IsDevelopment())
|
||||
{
|
||||
builder.Entity<Brand>()
|
||||
.HasData(
|
||||
new Brand { Id = 1, Name = "Brand 1", Description = "Description 1", AvailableProductCount = 3 },
|
||||
new Brand { Id = 2, Name = "Brand 2", Description = "Description 2", AvailableProductCount = 2 },
|
||||
new Brand { Id = 3, Name = "Brand 3", Description = "Description 3", AvailableProductCount = 3 }
|
||||
);
|
||||
|
||||
builder.Entity<Category>()
|
||||
.HasData(
|
||||
new Category { Id = 1, Name = "Category 1", AvailableProductCount = 4 },
|
||||
new Category { Id = 2, Name = "Category 2", AvailableProductCount = 3 },
|
||||
new Category { Id = 3, Name = "Category 3", AvailableProductCount = 2 }
|
||||
);
|
||||
|
||||
builder.Entity<Product>()
|
||||
.HasData(
|
||||
new Product { Id = 1, Name = "Product 1", Description = "Description of product 1.", BrandId = 1, CategoryId = 2, Active = true },
|
||||
new Product { Id = 2, Name = "Product 2", Description = "Description of product 2.", BrandId = 2, CategoryId = 3, Active = true },
|
||||
new Product { Id = 3, Name = "Product 3", Description = "Description of product 3.", BrandId = 3, CategoryId = 1, Active = true },
|
||||
new Product { Id = 4, Name = "Product 4", Description = "Description of product 4.", BrandId = 1, CategoryId = 2, Active = true },
|
||||
new Product { Id = 5, Name = "Product 5", Description = "Description of product 5.", BrandId = 2, CategoryId = 3, Active = true },
|
||||
new Product { Id = 6, Name = "Product 6", Description = "Description of product 6.", BrandId = 3, CategoryId = 1, Active = true },
|
||||
new Product { Id = 7, Name = "Product 7", Description = "Description of product 7.", BrandId = 1, CategoryId = 2, Active = true }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user