Esempio n. 1
0
        //[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "admin")]
        public IActionResult GetAllIssues()
        {
            var filters = this.GetFilters();

            var issues = filters.Q != null?filterService.GetAllByFilterQ(filters.Q) : issueService.GetAll().AsQueryable();

            issues = filters.Id != null?filterService.GetAllByFilterId(issues, filters.Id) : issues;

            issues = filters.Status != null?issueHelperFunction.GetAllByCustomFilterStatus(issues, filters.Status) : issues;

            issues = filters.Priority != null?issueHelperFunction.GetAllByCustomFilterPriority(issues, filters.Priority) : issues;

            issues = (filters.FromDate != null && filters.ToDate != null) ? issueHelperFunction.GetAllByStartAndEndDate(issues, filters.FromDate, filters.ToDate) : issues;
            issues = (filters.FromDate != null && filters.ToDate == null) ? issueHelperFunction.GetAllByStartAndEndDate(issues, filters.FromDate) : issues;
            issues = (filters.ToDate != null && filters.ToDate == null) ? issueHelperFunction.GetAllByEndDate(issues, filters.ToDate) : issues;
            issues = filters.CustomFilters.Count > 0 && filters.CustomFilters != null
                       ? filterService.GetAllByFilterReferenceId(issues, filters.ReferenceId)
                       : issues;


            var totalElems = issues.Count();

            issues = issues.Skip(filters.BeginIndex).Take(filters.Limit);

            var issueDto = mapper.Map <IEnumerable <IssueForListDto> >(issues);

            HttpContext.Response.Headers.Add("Content-Range", $"issue {filters.BeginIndex} - {issueDto.Count() - 1}/ {totalElems}");
            return(Ok(new DtoOutput <IEnumerable <IssueForListDto> >(issueDto)));
        }
Esempio n. 2
0
        public IActionResult GetDepartments()
        {
            var filters     = this.GetFilters();
            var departments = filters.Q != null?filterService.GetAllByFilterQ(filters.Q) : departmentService.GetAll().AsQueryable();

            departments = filters.Id != null?filterService.GetAllByFilterId(departments, filters.Id) : departments;

            //categories = filters.CustomFilters.Count > 0 && filters.CustomFilters != null
            //             ? filterService.GetAllByFilterReferenceId(categories, filters.ReferenceId)
            //             : categories;
            var totalElems = departments.Count();

            departments = departments.Skip(filters.BeginIndex).Take(filters.Limit);
            var departmentDto = mapper.Map <IEnumerable <DepartmentDto> >(departments);

            HttpContext.Response.Headers.Add("Content-Range", $"departments {filters.BeginIndex} - {departmentDto.Count() - 1}/ {totalElems}");
            return(Ok(new DtoOutput <IEnumerable <DepartmentDto> >(departmentDto)));
        }
Esempio n. 3
0
        public IActionResult GetSubCategories()
        {
            var filters       = this.GetFilters();
            var subCategories = filters.Q != null?filterService.GetAllByFilterQ(filters.Q) : subCategoryService.GetAll().AsQueryable();

            subCategories = filters.Id != null?filterService.GetAllByFilterId(subCategories, filters.Id) : subCategories;

            subCategories = filters.CustomFilters.Count > 0 && filters.CustomFilters != null
                         ? filterService.GetAllByFilterReferenceId(subCategories, filters.ReferenceId)
                         : subCategories;

            var totalElems = subCategories.Count();

            subCategories = subCategories.Skip(filters.BeginIndex).Take(filters.Limit);

            var subCategoryDto = mapper.Map <IEnumerable <SubCategoriesDto> >(subCategories);

            HttpContext.Response.Headers.Add("Content-Range", $"subcategories {filters.BeginIndex} - {subCategoryDto.Count() - 1}/ {totalElems}");
            return(Ok(new DtoOutput <IEnumerable <SubCategoriesDto> >(subCategoryDto)));
        }