Пример #1
0
        public async Task <WebsiteProxy> Get(int id)
        {
            var website = await WebsiteRepository.Get(id);

            if (website is null)
            {
                throw new NotFoundError($"Website with id {id} not found");
            }

            return(website);
        }
Пример #2
0
        public async Task <WebsiteProxy[]> Get(int?page,
                                               int?pageSize,
                                               WebsiteOrderByEnum?orderBy,
                                               WebsiteOrderByAscDescEnum?orderType)
        {
            var totalRecords = await GetCount();

            if (totalRecords == 0)
            {
                return(Enumerable.Empty <WebsiteProxy>().ToArray());
            }

            PagingValidator.Validate(totalRecords, page, pageSize);

            return(await WebsiteRepository.Get(page, pageSize, orderBy, orderType));
        }