it ipimiutduioi

This commit is contained in:
MarcEricMartel
2022-10-30 13:58:47 -07:00
parent 8a5b00624e
commit a8bf691e21
13 changed files with 892 additions and 75 deletions

View File

@@ -1,9 +1,11 @@
using Microsoft.EntityFrameworkCore;
using GrossesMitainesAPI.Models;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity;
namespace GrossesMitainesAPI.Data;
public class InventoryContext : DbContext {
public class InventoryContext : IdentityDbContext<InventoryUser> {
public DbSet<Product> Products { get; set; }
public InventoryContext(DbContextOptions<InventoryContext> options) : base(options) { }
@@ -198,6 +200,10 @@ public class InventoryContext : DbContext {
Quantity = 16,
ImageName = $"mitaines2"
});
InventoryUser admin = new InventoryUser() { NormalizedUserName = "admin", UserName = "Admin", NormalizedEmail = "admin@admin.com", Email = "admin@admin.com" };
admin.PasswordHash = new PasswordHasher<InventoryUser>().HashPassword(admin, "Qwerty123!");
modelBuilder.Entity<InventoryUser>().HasData(admin);
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
var configuration = new ConfigurationBuilder()