public string UpdateRequest(UpdateRequestDetailsDTO updateRequestDetailsDTO) { MyApprovalRepository approvalRepo = new MyApprovalRepository(); UpdateRequestDetailsDO updateRequestDetailsDO = new UpdateRequestDetailsDO { Comment = updateRequestDetailsDTO.Comment, Option = updateRequestDetailsDTO.Option, RequestNo = updateRequestDetailsDTO.RequestNo, UserName = updateRequestDetailsDTO.UserName, TaskId = updateRequestDetailsDTO.TaskId }; string status = approvalRepo.UpdateRequestDA(updateRequestDetailsDO); return(status); }
public ActionResult UpdateRequest(ApprovalRequestDetailsVM approvalRequestDetailsVM) { string eightDigitNumber = string.Empty; GetApprovalBS getApprovalBSobj = new GetApprovalBS(); UpdateRequestDetailsDTO UpdateRequestDetailsDTO = new UpdateRequestDetailsDTO { Comment = approvalRequestDetailsVM.Comment, Option = approvalRequestDetailsVM.Option, RequestNo = approvalRequestDetailsVM.RequestNo, UserName = approvalRequestDetailsVM.UserName }; if (approvalRequestDetailsVM.Option == "Approve") { Random r = new Random(); int randNum = r.Next(1000000); eightDigitNumber = randNum.ToString("D8"); UpdateRequestDetailsDTO.TaskId = "TASK0000" + eightDigitNumber; } else { UpdateRequestDetailsDTO.TaskId = eightDigitNumber; } string status = getApprovalBSobj.UpdateRequest(UpdateRequestDetailsDTO); ApprovalStatus approvalStatusVM = new ApprovalStatus(); if (status.ToUpper() == "UPDATED") { approvalStatusVM.Status = "UPDATED"; approvalStatusVM.TaskId = "TASK0000" + eightDigitNumber; } else { approvalStatusVM.Status = "FAILED"; approvalStatusVM.TaskId = eightDigitNumber; } return(Json(approvalStatusVM, JsonRequestBehavior.AllowGet)); }