public IActionResult Index() { // var isSignedIn = this._signInManager.IsSignedIn(HttpContext.User); // var currentUserId = this._signInManager.UserManager.GetUserId(HttpContext.User); // if (isSignedIn) // { // var MediaUser = service.GetAllMediaUseren().FirstOrDefault(p => p.Id == currentUserId); // if (MediaUser == null) // { // var newMediaUser = new MediaUser // { // Id = currentUserId, // }; // service.InsertMediaUser(newMediaUser); // service.SaveChanges(); // } // // _currentMediaUser = service.GetAllMediaUseren().First(p => p.Id == currentUserId); // // } var series = _mediaService.GetAllSeries(); if (series != null && series.Any()) { var seriesViewModels = series.Select(MapToListViewModel).ToList(); return(View(seriesViewModels)); } return(View(new List <SerieListViewModel>())); }
public IActionResult AddEpisode(int serieId) { var selectedSerie = _mediaService.GetAllSeries().First(serie => serie.Id == serieId); selectedSerie.Seasons = _mediaService.GetAllSeasons().Where(z => z.Serie.Id == serieId).ToList(); var Seasonen = selectedSerie.Seasons == null ? new List <Season>() : selectedSerie.Seasons.ToList(); EpisodeCreateViewModel Epimodel = new EpisodeCreateViewModel() { SerieName = selectedSerie.Name, PossibleSeasons = Seasonen, ReleaseDate = DateTime.Now }; return(View(Epimodel)); }
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)); }