public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Manufacturer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ManufacturerExists(Manufacturer.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Manufacturer.Add(Manufacturer); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Manufacturer = await _context.Manufacturer.FindAsync(id); if (Manufacturer != null) { _context.Manufacturer.Remove(Manufacturer); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Collectible = await _context.Collectible.FindAsync(id); if (Collectible != null) { _context.Collectible.Remove(Collectible); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }