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