public PagedList <Podcast> FindAll(PodcastsParametrs parameters)
        {
            var podcasts = FindAll();

            SearchByName(ref podcasts, parameters.Name);
            SearchByGenre(ref podcasts, parameters.Genre);
            SearchByAuthorName(ref podcasts, parameters.AuthorName);
            ApplySort(ref podcasts, parameters.OrderBy);

            return(PagedList <Podcast> .ToPagedList(podcasts,
                                                    parameters.PageNumber,
                                                    parameters.PageSize));
        }
Example #2
0
        public IActionResult GetListPodcasts([FromQuery] PodcastsParametrs parameters)
        {
            string strUserId = User.FindFirstValue(ClaimTypes.NameIdentifier);
            Guid   userId    = string.IsNullOrEmpty(strUserId) ? Guid.NewGuid() : new Guid(strUserId);

            PagedList <Podcast> podcasts = _repoWrapper.Podcast.FindAll(parameters);

            Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(podcasts.MetaData));

            List <PodcastGetModel> podcastModel = _statisticService.TransformPodcast(podcasts, userId);

            return(Ok(podcastModel));
        }