Ejemplo n.º 1
0
        public static PagedResponse <T> CreatePaginationResponse(IUirService uriService, PaginationFilter paginationFilter, List <T> response)
        {
            var nextPage = paginationFilter.PageNumber >= 1
                ? uriService.GetAllPostUri(new PaginationQuery(paginationFilter.PageNumber + 1,
                                                               paginationFilter.PageSize)).ToString()
                : null;

            var previuosPage = paginationFilter.PageNumber - 1 >= 1
                ? uriService.GetAllPostUri(new PaginationQuery(paginationFilter.PageNumber - 1,
                                                               paginationFilter.PageSize)).ToString()
                : null;

            return(new PagedResponse <T>
            {
                Data = response,
                PageNumber = paginationFilter.PageNumber >= 1 ? paginationFilter.PageNumber : (int?)null,
                PageSize = paginationFilter.PageSize >= 1 ? paginationFilter.PageSize : (int?)null,
                NextPage = response.Any() ? nextPage : null,
                PreviuosPage = previuosPage
            });
        }
Ejemplo n.º 2
0
 public ExpensesController(IExpenseService expenseService, IMapper mapper, IUirService uirService)
 {
     _expenseService = expenseService;
     _mapper         = mapper;
     _uriService     = uirService;
 }