Esempio n. 1
0
        public GeneralResponse AddCourierEmployee(AddCourierEmployeeRequest request, Guid CreateEployeeID)
        {
            GeneralResponse response = new GeneralResponse();

            try
            {
                CourierEmployee courierEmployee = new CourierEmployee();
                courierEmployee.ID             = Guid.NewGuid();
                courierEmployee.CreateDate     = PersianDateTime.Now;
                courierEmployee.CreateEmployee = _employeeRepository.FindBy(CreateEployeeID);
                courierEmployee.Address        = request.Address;
                courierEmployee.FirstName      = request.FirstName;
                courierEmployee.LastName       = request.LastName;
                courierEmployee.Mobile         = request.Mobile;
                courierEmployee.Phone          = request.Phone;
                courierEmployee.RowVersion     = 1;

                _courierEmployeeRepository.Add(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 Courieremployee_Insert(AddCourierEmployeeRequest request)
        {
            GeneralResponse response = new GeneralResponse();

            #region Access Check

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

            #endregion

            //AddCourierEmployeeRequest request=new AddCourierEmployeeRequest();
            //request.Address = "خیابان فرجام";
            //request.FirstName = "محمد";
            //request.LastName = "ظفری";
            //request.Mobile = "09190737487";
            //request.Phone = "44444444";

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

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