public ContactsController(WyoomingContext context, IAuthorizationService authorizationService, UserManager <ApplicationUser> userManager) { _context = context; _userManager = userManager; _authorizationService = authorizationService; }
public static async Task Initialize(IServiceProvider serviceProvider, string testUserPw) { using (var context = new WyoomingContext( serviceProvider.GetRequiredService <DbContextOptions <WyoomingContext> >())) { var uid = await CreateTestUser(serviceProvider, testUserPw); SeedDB(context, uid); } }
public static void SeedDB(WyoomingContext context, string adminID) { if (context.Contact.Any()) { return; } context.Contact.AddRange( new Contact { Name = "Debra Garcia", Address = "1234 Main St", City = "Redmond", State = "WA", Zip = "10999", Email = "*****@*****.**", Status = ContactStatus.Approved, OwnerID = adminID }, new Contact { Name = "Thorsten Weinrich", Address = "5678 1st Ave W", City = "Redmond", State = "WA", Zip = "10999", Email = "*****@*****.**", Status = ContactStatus.Approved, OwnerID = adminID }, new Contact { Name = "Yuhong Li", Address = "9012 State st", City = "Redmond", State = "WA", Zip = "10999", Email = "*****@*****.**", Status = ContactStatus.Approved, OwnerID = adminID }, new Contact { Name = "Jon Orton", Address = "3456 Maple St", City = "Redmond", State = "WA", Zip = "10999", Email = "*****@*****.**", Status = ContactStatus.Approved, OwnerID = adminID }, new Contact { Name = "Diliana Alexieva-Bosseva", Address = "7890 2nd Ave E", City = "Redmond", State = "WA", Zip = "10999", Email = "*****@*****.**", Status = ContactStatus.Approved, OwnerID = adminID } ); context.SaveChanges(); }