public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Cart).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CartExists(Cart.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } // var siteToUpdate = await _context.FavoriteWebSites.FindAsync(id); _context.Attach(FavoriteWebSites).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FavoriteWebSitesExists(FavoriteWebSites.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }