예제 #1
0
        public async Task <ActionResult> GetAllTimes([FromQuery] ParametersPage parametersPage)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                var back = await _timeAppService.GetAll(parametersPage);

                var result   = _mapper.MapList <TimeEntity, TimeViewModel>(back);
                var metadata = new
                {
                    result.TotalCount,
                    result.PageSize,
                    result.CurrentPage,
                    result.TotalPages,
                    result.HasNext,
                    result.HasPrevious
                };

                Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(metadata));
                return(Ok(result));
            }
            catch (ArgumentException ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message));
            }
        }
예제 #2
0
 public SequenceParameterPages(BinaryReader bReader)
 {
     numberOfPages  = bReader.ReadInt32();
     parametersPage = new ParametersPage[numberOfPages];
     for (int i = 0; i < numberOfPages; i++)
     {
         parametersPage[i] = new ParametersPage(bReader);
     }
 }
예제 #3
0
 public async Task <IEnumerable <T> > SelectAsync(ParametersPage parametersPage)
 {
     return(await _dataset.Where(x => !x.isDeleted).Skip((parametersPage.PageNumber - 1) * parametersPage.PageSize)
            .Take(parametersPage.PageSize).AsNoTracking().
            ToListAsync());
 }
예제 #4
0
 public async Task <PagedList <T> > SelectPaged(ParametersPage parametersPage)
 {
     return(await Task.FromResult(PagedList <T> .ToPagedList(_dataset.Where(x => !x.isDeleted).AsNoTracking(),
                                                             parametersPage.PageNumber,
                                                             parametersPage.PageSize)));
 }
예제 #5
0
 public async Task <PagedList <CampeonatoEntity> > GetAll(ParametersPage parametersPage)
 {
     return(await _repository.SelectPaged(parametersPage));
 }
예제 #6
0
 public async Task <PagedList <TimeEntity> > GetAll(ParametersPage parametersPage)
 {
     return(await _timeService.GetAll(parametersPage));
 }
예제 #7
0
        public new async Task <IEnumerable <TimeEntity> > SelectAsync(ParametersPage parametersPage)
        {
            var result = await base.SelectAsync(parametersPage);

            return(result.OrderBy(x => x.nome));
        }
예제 #8
0
 public async Task <PagedList <CampeonatoEntity> > GetAll(ParametersPage parametersPage)
 {
     return(await _campeonatoService.GetAll(parametersPage));
 }