// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(ShipOrder).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShipOrderExists(ShipOrder.ShipId, ShipOrder.OrderId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Ship.Add(Ship); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Ship = await _context.Ship.FindAsync(id); if (Ship != null) { _context.Ship.Remove(Ship); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int shipId, int orderId) { if (shipId == 0 || orderId == 0) { return(NotFound()); } ShipOrder = await _context.ShipOrder.FindAsync(shipId, orderId); if (ShipOrder != null) { _context.ShipOrder.Remove(ShipOrder); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } try { _context.ShipOrder.Add(ShipOrder); await _context.SaveChangesAsync(); } catch { failed = true; return(Page()); } return(RedirectToPage("./Index")); }