Exemplo n.º 1
0
        public async Task <ActionResult <PaginatedList <WorkItemViewModel> > > GetFailed(
            [FromQuery] PagingParameters pagingParameters
            )
        {
            var result = await this.service.GetFailedAsync(pagingParameters);

            this.AddXPagination(pagingParameters, result);

            return(Ok(result));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <IEnumerable <WorkItem> > > GetFailed(
            [FromQuery] PagingParameters pagingParameters
            )
        {
            PaginatedList <WorkItem> result
                = await _workItemService.GetFailedAsync(pagingParameters);

            AddXPagination(pagingParameters, result);

            return(Ok(result));
        }
Exemplo n.º 3
0
        public async Task <ActionResult <PaginatedList <WorkItemViewModel> > > GetUpcommings(
            [FromQuery] PagingParameters pagingParameters
            )
        {
            PaginatedList <WorkItemViewModel> result
                = await this.workItemService.GetUpCommingsAsync(pagingParameters);

            this.AddXPagination(pagingParameters, result);

            return(Ok(result));
        }
        public async Task <PaginatedList <WorkItemViewModel> > GetFailedAsync(
            PagingParameters parameters
            )
        {
            var result = await this.workItemService.GetFailedAsync(parameters);

            return(new PaginatedList <WorkItemViewModel>(
                       result.Select(x => ToViewModel(x)),
                       result.AllItemsCount,
                       parameters.PageIndex,
                       parameters.PageSize
                       ));
        }
Exemplo n.º 5
0
        private void AddXPagination(
            PagingParameters pagingParameters,
            PaginatedList <WorkflowViewModel> result
            )
        {
            var paginationMetadata = new
            {
                totalCount = result.AllItemsCount,
                pageSize   = pagingParameters.PageSize,
                pageIndex  = pagingParameters.PageIndex,
                totalPages = result.TotalPages
            };

            Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(paginationMetadata));
        }
Exemplo n.º 6
0
        public async Task <PaginatedList <WorkItem> > GetFailedAsync(PagingParameters pagingParameters)
        {
            var count = _context.WorkItems
                        .Where(wi => wi.Retries > Constants.WORKITEM_RETRIES)
                        .Count();

            var items = await _context.WorkItems
                        .Where(wi => wi.Retries > Constants.WORKITEM_RETRIES)
                        .OrderBy(wi => wi.DueDate)
                        .AsNoTracking()
                        .ToListAsync <WorkItem>();

            return(new PaginatedList <WorkItem>(
                       items,
                       count,
                       pagingParameters.PageIndex,
                       pagingParameters.PageSize
                       ));
        }
Exemplo n.º 7
0
        public async Task <PaginatedList <WorkItemViewModel> > GetFailedAsync(
            PagingParameters pagingParameters
            )
        {
            var count = await this.repository
                        .CountAsync(new WorkItemRetryLimitHitCount(WorkItem.WORKITEM_RETRIES));

            var items = await this.repository
                        .ListAsync(new WorkItemRetryLimitHitCountOrderedPaginated(
                                       WorkItem.WORKITEM_RETRIES,
                                       pagingParameters.SkipCount,
                                       pagingParameters.PageSize
                                       ));

            return(new PaginatedList <WorkItemViewModel>(
                       ViewModelMapper.ToWorkItemViewModelList(items),
                       count,
                       pagingParameters.PageIndex,
                       pagingParameters.PageSize
                       ));
        }
Exemplo n.º 8
0
        public async Task <PaginatedList <WorkItem> > GetUpCommingsAsync(PagingParameters pagingParameters)
        {
            var count = _context.WorkItems
                        .Where(wi => wi.DueDate > SystemTime.Now())
                        .Count();

            var items = await _context.WorkItems
                        .Where(wi => wi.DueDate > SystemTime.Now())
                        .OrderBy(wi => wi.DueDate)
                        .Skip(pagingParameters.SkipCount)
                        .Take(pagingParameters.PageSize)
                        .AsNoTracking()
                        .ToListAsync <WorkItem>();

            return(new PaginatedList <WorkItem>(
                       items,
                       count,
                       pagingParameters.PageIndex,
                       pagingParameters.PageSize
                       ));
        }
Exemplo n.º 9
0
        public async Task <PaginatedList <WorkItemViewModel> > GetUpCommingsAsync(
            PagingParameters pagingParameters
            )
        {
            var now = SystemTime.Now();

            var count = await this.repository
                        .CountAsync(new WorkItemDueDateGreaterThanNowCount(now));

            var items = await this.repository
                        .ListAsync(new WorkItemDueDateGreaterThanNowOrderedPaginated(
                                       now,
                                       pagingParameters.SkipCount,
                                       pagingParameters.PageSize
                                       ));

            return(new PaginatedList <WorkItemViewModel>(
                       ViewModelMapper.ToWorkItemViewModelList(items),
                       count,
                       pagingParameters.PageIndex,
                       pagingParameters.PageSize
                       ));
        }