Ejemplo n.º 1
0
 public ActionResult SaveOrder(int id, string status, int? brigadeId, int? transportId)
 {
     if (Request.IsAjaxRequest())
     {
         OrderForSave order = new OrderForSave
         {
             Id = id,
             BrigadeId = brigadeId,
             TransportId = transportId,
             Status = status,
         };
         var savedOrder = AdminService.SaveOrder(order);
         if (savedOrder != null)
         {
             return PartialView("SaveSuccess", savedOrder);
         }
     }
     return View("Error");
 }
Ejemplo n.º 2
0
 public SavedOrder SaveOrder(OrderForSave order)
 {
     var orderEdit = _context.Orders.Get(order.Id);
     if (order != null)
     {
         orderEdit.Status = order.Status;
         orderEdit.BrigadeId = order.BrigadeId;
         orderEdit.TransportId = order.TransportId;
         _context.Orders.Update(orderEdit);
         int saveResult = _context.Save();
         if (saveResult > 0)
         {
             return new SavedOrder
             {
                 Id = orderEdit.Id,
                 Status = orderEdit.Status,
                 Brigade = orderEdit.Brigade != null ? orderEdit.Brigade.Title : null,
                 Transport = orderEdit.Transport != null ? orderEdit.Transport.Name : null,
             };
         }
     }
     return null;
 }