public IActionResult Index()
        {
            var podcasts    = _mediaService.GetAllPodcasts().ToList();
            var podcastList = new List <PodcastListViewModel>();

            podcastList = podcasts.Select(pl =>
                                          new PodcastListViewModel
            {
                Id    = pl.Id,
                Name  = pl.Name,
                Photo = pl.Photo
            }).ToList();

            return(View(podcastList));
        }
Example #2
0
        public IActionResult Index()
        {
            var currentUserId = this._signInManager.UserManager.GetUserId(HttpContext.User);
            var user          = _mediaService.GetAllMediaUsers().Where(prof => prof.Id == currentUserId).FirstOrDefault();
            var media         = _mediaService.GetAllMedia().OfType <Movie>().Take(10);
            var topMovies     = _mediaService.GetAllMedia().OfType <Movie>().Take(10).Where(m => m.IsPublic == true) /*.OrderBy(r => r.Ratings)*/;
            var topSeries     = _mediaService.GetAllSeries().Take(10).Where(m => m.IsPublic == true);
            var topMusic      = _mediaService.GetAllMedia().OfType <Music>().Take(10).Where(m => m.IsPublic == true) /*.OrderBy(r => r.Ratings) */;
            var topPodcasts   = _mediaService.GetAllPodcasts().Take(10).Where(m => m.IsPublic == true) /*.OrderBy(r => r.Ratings)*/;
            var topPlaylists  = _mediaService.GetAllPlaylists().Take(10).Where(m => m.MediaUser == _currentMediaUser);

            var vm = new HomeOverviewViewModel
            {
                Movies     = topMovies,
                Series     = topSeries,
                Musics     = topMusic,
                Podcasts   = topPodcasts,
                PlayLists  = topPlaylists,
                IsSignedIn = true, //isSignedIn,
                MediaUser  = user  //_currentMediaUser
            };

            return(View(vm));
        }