Beispiel #1
0
        public async Task <PaginatedSmsModel> RetrievePaginatedSmsAsync(int currentPage, int pageSize, string phoneNumber, string messageId)
        {
            if (currentPage < 1)
            {
                throw new ArgumentException("Current page can't be negative or zero", nameof(currentPage));
            }

            if (pageSize < 1)
            {
                throw new ArgumentException("Page size can't be negative or zero", nameof(pageSize));
            }

            var skip = (currentPage - 1) * pageSize;
            var take = pageSize;

            var paginatedSmsModel = await _repository.RetrievePaginatedSmsAsync(skip, take, phoneNumber, messageId);

            paginatedSmsModel.CurrentPage = currentPage;

            return(paginatedSmsModel);
        }