예제 #1
0
 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");
 }
예제 #2
0
        public async Task<ActionResult> Create(Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Orders.Add(order);
                await _context.SaveChangesAsync();
                return RedirectToAction("Index", "Order");
            }

            return View(order);
        }