Exemplo n.º 1
0
        public JsonResult Couriers_read(int?pageSize, int?pageNumber, IList <FilterData> filter, string sort)
        {
            GetGeneralResponse <IEnumerable <CourierView> > response = new GetGeneralResponse <IEnumerable <CourierView> >();


            int PageNumber = pageNumber == null ? -1 : (int)pageNumber;
            int PageSize   = pageSize == null ? -1 : (int)pageSize;

            #region Access Check and retrive data

            EmployeeView employee      = GetEmployee();
            bool         hasPermission = employee.IsGuaranteed("Courier_CangeStatus");
            if (hasPermission)
            {
                response = _courierService.GetAllCouriers(PageSize, PageNumber, filter, ConvertJsonToObject(sort));
            }
            else
            {
                response = _courierService.GetAllCouriersByEmployee(PageSize, PageNumber, filter,
                                                                    ConvertJsonToObject(sort), employee.ID);
            }
            #endregion



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