public IndexModel(CommunityPricing.Data.CommunityPricingContext context, IAuthorizationService authorizationService, UserManager <ApplicationUser> userManager) : base(context, authorizationService, userManager) { _context = context; }
public VendorSelectList(CommunityPricing.Data.CommunityPricingContext context, IAuthorizationService authorizationService, UserManager <ApplicationUser> userManager) : base(context, authorizationService, userManager) { _context = context; }
public static async Task Initialize(IServiceProvider serviceProvider, string testUserPw) { using (var context = new CommunityPricingContext( serviceProvider.GetRequiredService <DbContextOptions <CommunityPricingContext> >())) { // For sample purposes seed both with the same password. // Password is set with the following: // dotnet user-secrets set SeedUserPW <pw> // The admin user can do anything var adminID = await EnsureUser(serviceProvider, testUserPw, "*****@*****.**"); await EnsureRole(serviceProvider, adminID, Constants.AdministratorsRole); SeedDB(context, adminID); } }
public static void SeedDB(CommunityPricingContext context, string adminID) { //context.Database.EnsureCreated(); if (context.Product.Any()) { return; } Guid guid1 = Guid.NewGuid(); Guid guid2 = Guid.NewGuid(); Guid guid3 = Guid.NewGuid(); var productCategory = new ProductCategory { ProductCategoryID = 1000, Name = "Test Category" }; context.ProductCategory.Add(productCategory); context.SaveChanges(); var products = new Product[] { new Product { ProductID = guid1, ProductName = "Product A", ProductDescr1 = "Desc1", ProductDescr2_Wt_Vol = "1lb", ProductCategoryID = 1000, Wholesaler = "Unknown", }, new Product { ProductID = guid2, ProductName = "Product B", ProductDescr1 = "Desc1", ProductDescr2_Wt_Vol = "1lb", ProductCategoryID = 1000, Wholesaler = "Unknown" }, new Product { ProductID = guid3, ProductName = "Product C", ProductDescr1 = "Desc1", ProductDescr2_Wt_Vol = "1lb", ProductCategoryID = 1000, Wholesaler = "Unknown" } }; foreach (var product in products) { context.Product.Add(product); } context.SaveChanges(); /*return; */ // DB has been seeded }
public DeleteModel(CommunityPricing.Data.CommunityPricingContext context) { _context = context; }
public ArchiveOffering(CommunityPricing.Data.CommunityPricingContext context) { _context = context; }