public GeneralResponse EditCourierEmployee(EditCourierEmployeeRequest request, Guid ModifiedEmployeeID)
        {
            GeneralResponse response = new GeneralResponse();

            try
            {
                CourierEmployee courierEmployee = new CourierEmployee();
                courierEmployee = _courierEmployeeRepository.FindBy(request.ID);

                courierEmployee.ModifiedDate     = PersianDateTime.Now;
                courierEmployee.ModifiedEmployee = _employeeRepository.FindBy(ModifiedEmployeeID);
                courierEmployee.Address          = request.Address;
                courierEmployee.FirstName        = request.FirstName;
                courierEmployee.LastName         = request.LastName;
                courierEmployee.Phone            = request.Phone;
                courierEmployee.Mobile           = request.Mobile;

                #region Row Version Check

                if (courierEmployee.RowVersion != request.RowVersion)
                {
                    response.ErrorMessages.Add("EditConcurrencyKey");
                    return(response);
                }
                else
                {
                    courierEmployee.RowVersion += 1;
                }

                if (courierEmployee.GetBrokenRules().Count() > 0)
                {
                    foreach (BusinessRule businessRule in courierEmployee.GetBrokenRules())
                    {
                        response.ErrorMessages.Add(businessRule.Rule);
                    }

                    return(response);
                }


                #endregion

                _courierEmployeeRepository.Save(courierEmployee);
                _uow.Commit();
            }
            catch (Exception ex)
            {
                response.ErrorMessages.Add(ex.Message);
                if (ex.InnerException != null)
                {
                    response.ErrorMessages.Add(ex.InnerException.Message);
                }
            }

            return(response);
        }
        public JsonResult CourierEployee_Update(EditCourierEmployeeRequest request)
        {
            GeneralResponse response = new GeneralResponse();

            #region Access Check

            bool hasPermission = GetEmployee().IsGuaranteed("CourierEmployee_Update");
            if (!hasPermission)
            {
                response.ErrorMessages.Add("AccessDenied");
                return(Json(response, JsonRequestBehavior.AllowGet));
            }

            #endregion

            response = _courierEmployeeService.EditCourierEmployee(request, GetEmployee().ID);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }