Exemple #1
0
 public async Task <IActionResult> OnPostAsync(int id)
 {
     if (ModelState.IsValid && !string.IsNullOrWhiteSpace(Author.LastName))
     {
         try
         {
             Author.Id = id;
             db.Attach(Author).State = EntityState.Modified;
             await db.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException ex)
         {
             ViewData["Error"] = $"UpdateConcurrencyException: {ex.Message}";
             return(RedirectToPage("./Index"));
         }
     }
     return(RedirectToPage("./Index"));
 }