public IActionResult Update(OrderUpdateVM updateVM) { if (!ModelState.IsValid) { return(View(updateVM)); } _command.Update(updateVM); return(RedirectToAction("List")); }
public void Update(OrderUpdateVM updateVM) { _order.Id = updateVM.Id; _order.CustomerId = updateVM.CustomerId; _order.ProductId = updateVM.ProductId; _order.BillingAddress = updateVM.BillingAddress; _order.ShippingAddress = updateVM.ShippingAddress; _order.PaymentMethod = updateVM.PaymentMethod; _order.OrderStatus = updateVM.OrderStatus; _context.Entry(_order).State = EntityState.Modified; _context.SaveChanges(); }
public IActionResult Update(int id, OrderUpdateVM updateVM) { var order = _query.GetById(id); updateVM.Id = order.Id; updateVM.ProductId = order.ProductId; updateVM.CustomerId = order.CustomerId; updateVM.ProductName = __productService.GetById(order.ProductId).ProductName; updateVM.CustomerName = _customerService.GetById(order.CustomerId).UserName; updateVM.BillingAddress = order.BillingAddress; updateVM.ShippingAddress = order.ShippingAddress; updateVM.PaymentMethod = order.PaymentMethod; updateVM.OrderStatus = order.OrderStatus; return(View(updateVM)); }