public GeneralResponse EditCourier(EditCourierRequest request, Guid ModifiedEmployeeID) { GeneralResponse response = new GeneralResponse(); try { Courier courier = new Courier(); courier = _courierRepository.FindBy(request.ID); if (courier.CourierStatuse == Courier.CourierStatuses.Confirmed || courier.CourierStatuse == Courier.CourierStatuses.NotConfirmed) { response.ErrorMessages.Add( "این اعزام پیک قبلا تایید و یا رد شده است. لذا ویرایش آن امکان پذیر نمیباشد"); } courier.ModifiedDate = PersianDateTime.Now; courier.ModifiedEmployee = _employeeRepository.FindBy(ModifiedEmployeeID); courier.CourierStatuse = Courier.CourierStatuses.Pending; courier.Amount = request.Amount; courier.BuildingUnits = request.BuildingUnits; courier.CourierCost = request.CourierCost; courier.CourierEmployee = null; courier.CourierType = (Courier.CourierTypes)request.CourierType; courier.DeliverDate = request.DeliverDate; courier.DeliverTime = request.DeliverTime; courier.SaleComment = request.SaleComment; #region Row Version Check if (courier.RowVersion != request.RowVersion) { response.ErrorMessages.Add("EditConcurrencyKey"); return(response); } else { courier.RowVersion += 1; } if (courier.GetBrokenRules().Count() > 0) { foreach (BusinessRule businessRule in courier.GetBrokenRules()) { response.ErrorMessages.Add(businessRule.Rule); } return(response); } #endregion _courierRepository.Save(courier); _uow.Commit(); } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); if (ex.InnerException != null) { response.ErrorMessages.Add(ex.InnerException.Message); } } return(response); }