public ActionResult MovieToPlaylist(int MovieID, ListMovieViewModel model)
        {
            var result = context.MoviePlaylistCombs.FirstOrDefault(p => p.MovieID == MovieID && p.MoviePlaylistID == model.Playlist);

            if (result == null && model.Playlist != 0)
            {
                context.MoviePlaylistCombs.Add(new MoviePlaylistComb()
                {
                    MovieID = MovieID, MoviePlaylistID = model.Playlist
                });
                context.SaveChanges();
            }
            return(RedirectToAction(nameof(Index)));
        }
 public ActionResult MusicToPlaylist(int MusicID, MusicListViewModel model)
 {
     if (model.Playlist != 0)
     {
         _context.MusicPlaylistCombs.Add(new MusicPlaylistComb()
         {
             MusicID = MusicID, MusicPlaylistID = model.Playlist
         });
         _context.SaveChanges();
     }
     return(RedirectToAction(nameof(Index)));
 }
Esempio n. 3
0
        public async Task <ActionResult> Deleteconfirmed(string id)
        {
            if (id != null)
            {
                var user = await userManager.FindByIdAsync(id);

                var movies = context.Movies;
                foreach (var movie in movies)
                {
                    context.Movies.Remove(movie);
                }
                context.SaveChanges();

                await userManager.DeleteAsync(user);
            }
            return(RedirectToAction(nameof(Index)));
        }