public async Task <IActionResult> Edit( int?id, [Bind("Id, FirstName, LastName, EmailAddress, Phone, Address, City, State, Zip")] Author author ) { if (id != author.Id) { return(NotFound()); } if (ModelState.IsValid) { try { context.Update(author); await context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!context.Author.Any(a => a.Id == id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(RedirectToAction(nameof(Index))); }
public async Task <bool> InitializeDb() { // Delete and recreate the database with any migrations await authorDbContext.Database.EnsureDeletedAsync(); // Update the database with any migrations await authorDbContext.Database.MigrateAsync(); await authorDbContext.SaveChangesAsync(); await dataSeeder.DataSeed(userManager, roleManager); return(true); }
public async Task CompleteAsync() { await _context.SaveChangesAsync(); }