Пример #1
0
        public IActionResult Index()
        {
            var uploadLogic = new Uploadlogic(_podcastContext, _playlistContext);
            int userID      = (int)HttpContext.Session.GetInt32("UserID");
            var viewmodel   = new ManageModel();

            var playlists = new List <PlaylistModel>();
            var podcasts  = new List <PodcastModel>();

            foreach (var playlist in uploadLogic.GetAllPlaylistByUserID(userID))
            {
                playlists.Add(new PlaylistModel
                {
                    Title       = playlist.Title,
                    Description = playlist.Description,
                    Image       = playlist.Image
                });
            }

            viewmodel.Playlists = playlists;

            foreach (var podcast in uploadLogic.GetAllPodcastByUserID(userID))
            {
                podcasts.Add(new PodcastModel
                {
                    Title          = podcast.Title,
                    Description    = podcast.Description,
                    Image          = podcast.Image,
                    CreationDate   = podcast.CreationDate,
                    AgeRestriction = podcast.AgeRestriction
                });
            }

            return(View(viewmodel));
        }
Пример #2
0
        public IActionResult Index()
        {
            var uploadLogic = new Uploadlogic(_podcastContext, _playlistContext);
            var userID      = Convert.ToInt32(HttpContext.Session.GetInt32("UserID"));
            var viewmodel   = new UploadModel();

            var playlists = new List <PlaylistModel>();

            foreach (var playlist in uploadLogic.GetAllPlaylistByUserID(userID))
            {
                playlists.Add(new PlaylistModel
                {
                    Title       = playlist.Title,
                    Description = playlist.Description,
                    Image       = playlist.Image
                });
            }

            viewmodel.Playlists = playlists;
            return(View(viewmodel));
        }