public JsonResult SupportExpertDispatch_Update(EditSupportExpertDispatchRequest request) { GeneralResponse response = new GeneralResponse(); response = _supportExpertDispatchService.EditSupportExpertDispatch(request, GetEmployee().ID); return(Json(response, JsonRequestBehavior.AllowGet)); }
public GeneralResponse EditSupportExpertDispatch(EditSupportExpertDispatchRequest request, Guid ModifiedEmployeeID) { GeneralResponse response = new GeneralResponse(); try { SupportExpertDispatch supportExpertDispatch = new SupportExpertDispatch(); supportExpertDispatch = _supportExpertDispatchRepository.FindBy(request.ID); supportExpertDispatch.Comment = request.Comment; supportExpertDispatch.CoordinatorName = request.CoordinatorName; supportExpertDispatch.DispatchDate = request.DispatchDate; supportExpertDispatch.DispatchTime = request.DispatchTime; supportExpertDispatch.ExpertEmployee = _employeeRepository.FindBy(request.ExpertEmployeeID); supportExpertDispatch.ModifiedDate = PersianDateTime.Now; supportExpertDispatch.ModifiedEmployee = _employeeRepository.FindBy(ModifiedEmployeeID); supportExpertDispatch.IsNewInstallation = request.IsNewInstallation; #region Row Version Check if (supportExpertDispatch.RowVersion != request.RowVersion) { response.ErrorMessages.Add("EditConcurrencyKey"); return(response); } else { supportExpertDispatch.RowVersion += 1; } if (supportExpertDispatch.GetBrokenRules().Count() > 0) { foreach (BusinessRule businessRule in supportExpertDispatch.GetBrokenRules()) { response.ErrorMessages.Add(businessRule.Rule); } return(response); } #endregion //supportExpertDispatch.Support.SupportStatus = _supportStatusRepository.FindBy(request.SupportStatusID); supportExpertDispatch.Support.Customer.SupportStatus = supportExpertDispatch.Support.SupportStatus; _supportExpertDispatchRepository.Save(supportExpertDispatch); _uow.Commit(); } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }