public JsonResult SupportDeliverService_Update(EditSupportDeliverServiceRequest request) { GeneralResponse response = new GeneralResponse(); response = _supportDeliverServiceService.EditSupportDeliverService(request, GetEmployee().ID); return(Json(response, JsonRequestBehavior.AllowGet)); }
public GeneralResponse EditSupportDeliverService(EditSupportDeliverServiceRequest request, Guid ModifiedEmployeeID) { GeneralResponse response = new GeneralResponse(); try { SupportDeliverService supportDeliverService = new SupportDeliverService(); supportDeliverService = _supportDeliverServiceRepository.FindBy(request.ID); supportDeliverService.AmountRecived = request.AmountRecived; supportDeliverService.Comment = request.Comment; supportDeliverService.DeliverDate = request.DeliverDate; supportDeliverService.TimeInput = request.TimeInput; supportDeliverService.TimeOutput = request.TimeOutput; supportDeliverService.ModifiedDate = PersianDateTime.Now; supportDeliverService.ModifiedEmployee = _employeeRepository.FindBy(ModifiedEmployeeID); #region Row Version Check if (supportDeliverService.RowVersion != request.RowVersion) { response.ErrorMessages.Add("EditConcurrencyKey"); return(response); } else { supportDeliverService.RowVersion += 1; } if (supportDeliverService.GetBrokenRules().Count() > 0) { foreach (BusinessRule businessRule in supportDeliverService.GetBrokenRules()) { response.ErrorMessages.Add(businessRule.Rule); } return(response); } #endregion _supportDeliverServiceRepository.Save(supportDeliverService); _uow.Commit(); } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }