public async Task<ActionResult> Edit(int id, Order order) { order.Id = id; _context.Orders.Attach(order); _context.Entry(order).State = EntityState.Modified; await _context.SaveChangesAsync(); return RedirectToAction("Index", "Order"); }
public async Task<ActionResult> Create(Order order) { if (ModelState.IsValid) { _context.Orders.Add(order); await _context.SaveChangesAsync(); return RedirectToAction("Index", "Order"); } return View(order); }