-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9af4c2
commit 2ac5f99
Showing
11 changed files
with
375 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Exam.StockManagement.Domain.Entities.Models; | ||
using Exam.StockManagement.Infrastructure.Persistance; | ||
|
||
namespace Exam.StockManagement.API.Data | ||
{ | ||
public static class ProductSeedData | ||
{ | ||
public static async Task InitiliazeDataAsync(this IServiceProvider serviceProvider) | ||
{ | ||
var db = serviceProvider.GetRequiredService<StockManagementDbContext>(); | ||
if (!db.Products.Any()) | ||
{ | ||
List<Product> transports = [ | ||
new Product | ||
{ | ||
ProductName = "Asus TUF Gaming A17", | ||
ProductDescription = "AMD Ryzen™ 7 6800H", | ||
ProductPrice = 1200, | ||
ProductPicture = @"\images\51ZOFgc-4yL._AC_UF894,1000_QL80_.jpg", | ||
CreatedAt = DateTime.UtcNow, | ||
}, | ||
new Product | ||
{ | ||
ProductName = "Lenovo Legion 5 Pro", | ||
ProductDescription = "16ith6 i7-11800H 16/512GB SSD RTX3050-4GB 16", | ||
ProductPrice = 20, | ||
ProductPicture = @"\images\", | ||
CreatedAt = DateTime.UtcNow, | ||
} | ||
]; | ||
db.Products.AddRange(transports); | ||
await db.SaveChangesAsync(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+26.1 KB
Exam.StockManagement.API/wwwroot/images/51ZOFgc-4yL._AC_UF894,1000_QL80_.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.8 KB
...ckManagement.API/wwwroot/images/8a85a980-f250-4412-9532-6e5413e8cec6_myLogo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.8 KB
...ckManagement.API/wwwroot/images/db4c7987-1e16-453c-a706-76d72476434a_myLogo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 136 additions & 0 deletions
136
Exam.StockManagement.Infrastructure/Migrations/20240305051228_update1.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
Exam.StockManagement.Infrastructure/Migrations/20240305051228_update1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace Exam.StockManagement.Infrastructure.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class update1 : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.AlterColumn<string>( | ||
name: "ProductName", | ||
table: "Products", | ||
type: "character varying(100)", | ||
maxLength: 100, | ||
nullable: false, | ||
oldClrType: typeof(string), | ||
oldType: "character varying(30)", | ||
oldMaxLength: 30); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.AlterColumn<string>( | ||
name: "ProductName", | ||
table: "Products", | ||
type: "character varying(30)", | ||
maxLength: 30, | ||
nullable: false, | ||
oldClrType: typeof(string), | ||
oldType: "character varying(100)", | ||
oldMaxLength: 100); | ||
} | ||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
Exam.StockManagement.Infrastructure/Migrations/20240305070248_less.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
Exam.StockManagement.Infrastructure/Migrations/20240305070248_less.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace Exam.StockManagement.Infrastructure.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class less : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
|
||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.