public ActionResult UpdateEmployeeRequisition(Requisition requisition) { if (ModelState.IsValid) { Requisition editedRequisition = reqService.GetRequisitionById(requisition.RequisitionID); for (int i = 0; i < editedRequisition.RequisitionDetails.Count; i++) { editedRequisition.RequisitionDetails[i].QuantityReceived = requisition.RequisitionDetails[i].QuantityReceived; } if (reqService.IsCompleted(editedRequisition)) { editedRequisition.CompletedDate = DateTime.Now; editedRequisition.Status = Status.Completed; } else { editedRequisition.Status = Status.Incomplete; RetrievalList retrievalList = reqService.FindCurrentRetrievalList(); if (retrievalList == null) { retrievalList = reqService.CreateRetrievalList(); } reqService.IncompletedRequisitionTransferToRetrieval(editedRequisition, retrievalList); reqService.UpdateRetrievalList(retrievalList); } reqService.UpdateRequisition(editedRequisition); return(RedirectToAction("EmployeeRequisitionDetails", new { id = requisition.RequisitionID })); } return(View("~/Views/Department/Representative/UpdateEmployeeRequisition.cshtml", requisition)); }