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.MID)) { 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()); } Candy = await _context.Candy.FindAsync(id); if (Candy != null) { _context.Candy.Remove(Candy); 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")); }