public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Destination).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DestinationExists(Destination.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { ViewData["ManufacturerId"] = new SelectList(_context.ManufacturerContext, "Id", "Name"); return(Page()); } _context.Attach(Watch).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WatchExists(Watch.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }