public IActionResult Index() { var model = new PodcastModel(); model.podcasts = _podcastService.GetAll(); return(View(model)); }
public AppQuery( IAuthorService authorService, IPodcastService podcastService, IEpisodeService episodeService ) { Field <ListGraphType <AuthorType> >( "authors", resolve: context => authorService.GetAll() ); Field <AuthorType>( "author", arguments: new QueryArguments( new QueryArgument <IdGraphType> { Name = "id" } ), resolve: context => { var id = context.GetArgument <int>("id"); return(authorService.GetAuthorById(id)); } ); Field <ListGraphType <PodcastType> >( "podcasts", resolve: context => podcastService.GetAll() ); Field <PodcastType>( "podcast", arguments: new QueryArguments( new QueryArgument <IdGraphType> { Name = "id" } ), resolve: context => { var id = context.GetArgument <int>("id"); return(podcastService.GetPodcastById(id)); } ); Field <ListGraphType <EpisodeType> >( "episodes", resolve: context => episodeService.GetAll() ); Field <EpisodeType>( "episode", arguments: new QueryArguments( new QueryArgument <IdGraphType> { Name = "id" } ), resolve: context => { var id = context.GetArgument <int>("id"); return(episodeService.GetEpisodeById(id)); } ); }
public PodcastModel GetAll(int pageSize, int pageNumber) { var model = new PodcastModel(); var excludeRecords = (pageSize * pageNumber) - pageSize; var total = _podcastService.GetAll().Count; model.sectionName = "Photo"; model.pageSize = pageSize; model.pageTotal = Math.Ceiling((double)total / pageSize); model.podcastList = _podcastService.GetAll(excludeRecords, pageSize); if (model.pageTotal > 1) { model.displayPagination = true; } else { model.displayPagination = false; } return(model); }
public IActionResult Index() { var model = new HomeModel(); //SEO var homeSetting = _homeService.GetSetting(); ViewBag.description = homeSetting.headerTesto; //Get last post var posts = _postService.GetLast(5); var newsletterImageId = _homeService.GetSetting().newsletterImageId; var newsletterBackgroundImage = _photoService.GetById(newsletterImageId).path; model.Newsletter.backgroundImage = newsletterBackgroundImage; foreach (var post in posts) { model.PostDisplays.Add(new PostDisplayModel() { id = post.id, slug = _slugService.GetById(post.slugId).name, coverImage = _photoService.GetById(post.PhotoId).path, title = post.title, testo = Regex.Replace(post.testo, "<.*?>", string.Empty).Substring(0, 200) }); } var podcasts = _podcastService.GetAll(); foreach (var podcast in podcasts) { model.podcasts.Add(new PodcastModel() { id = podcast.id, name = podcast.name, description = podcast.description, path = podcast.path }); } return(View(model)); }