示例#1
0
        public ActionResult EditItem(Guid id)
        {
            var pendingConsignment = _consignmentItemService.GetPendingItem(id);

            if (pendingConsignment == null)
            {
                var activeConsignment = _consignmentItemService.GetById(id);
                var viewmodel         = new ConsignmentEditViewModel()
                {
                    Id            = activeConsignment.Id,
                    JobItemId     = activeConsignment.JobItem.Id,
                    SupplierName  = activeConsignment.Consignment.Supplier.Name,
                    SupplierId    = activeConsignment.Consignment.Supplier.Id,
                    Instructions  = activeConsignment.Instructions,
                    IsPending     = false,
                    ConsignmentId = activeConsignment.Consignment.Id
                };
                return(View("_EditItem", viewmodel));
            }
            else
            {
                var viewmodel = new ConsignmentEditViewModel()
                {
                    Id           = pendingConsignment.Id,
                    JobItemId    = pendingConsignment.JobItem.Id,
                    SupplierName = pendingConsignment.Supplier.Name,
                    SupplierId   = pendingConsignment.Supplier.Id,
                    Instructions = pendingConsignment.Instructions,
                    IsPending    = true
                };
                return(View("_EditItem", viewmodel));
            }
        }
示例#2
0
        public ActionResult Edit(Guid id)
        {
            var activeConsignment = _consignmentService.GetById(id);
            var viewmodel         = new ConsignmentEditViewModel()
            {
                Id           = activeConsignment.Id,
                SupplierName = activeConsignment.Supplier.Name,
                SupplierId   = activeConsignment.Supplier.Id
            };

            return(View("_Edit", viewmodel));
        }
示例#3
0
 public ActionResult EditItem(ConsignmentEditViewModel viewmodel)
 {
     if (viewmodel.IsPending)
     {
         _consignmentItemService.EditPending(
             viewmodel.Id,
             viewmodel.JobItemId,
             viewmodel.SupplierId,
             viewmodel.Instructions);
         return(RedirectToAction("PendingConsignments", "Consignment"));
     }
     else
     {
         _consignmentItemService.Edit(
             viewmodel.Id,
             viewmodel.Instructions);
         return(RedirectToAction("ConsignmentItems", "Consignment", new { consignmentId = viewmodel.ConsignmentId }));
     }
 }
示例#4
0
 public ActionResult Edit(ConsignmentEditViewModel viewmodel)
 {
     _consignmentService.Edit(viewmodel.Id, viewmodel.SupplierId);
     return(RedirectToAction("ActiveConsignments", "Consignment"));
 }