private async Task <List <ShortUrl> > GetShortUrls(GetAllShortUrlQuery request, long totalCount, CancellationToken cancellationToken = default(CancellationToken)) { List <ShortUrl> list = new List <ShortUrl>(); if (totalCount > 0 && request.Index.HasValue && request.Limit.HasValue && request.Limit.Value > 0) { list = CurrentUser.IsAdmin() ? await _shortUrlRepository.GetAllPagination(request.Index.Value, request.Limit.Value, cancellationToken) : await _shortUrlRepository.GetAllPaginationShortUrlsByUser(request.Index.Value, request.Limit.Value, CurrentUser.Id, cancellationToken); } else if (totalCount > 0) { list = CurrentUser.IsAdmin() ? await _shortUrlRepository.GetAll(cancellationToken) : await _shortUrlRepository.GetAllShortUrlsByUser(CurrentUser.Id, cancellationToken); } return(list); }