示例#1
0
        public async Task <IActionResult> Edit(int lastSerieID, SeasonViewModel model)
        {
            string uniqueFileName = null;

            if (ModelState.IsValid)
            {
                if (model.Photo != null)
                {
                    string UploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "images");
                    uniqueFileName = GetUniqueFilmName(model.Photo.FileName);
                    string filePath = Path.Combine(UploadsFolder, uniqueFileName);
                    model.Photo.CopyTo(new FileStream(filePath, FileMode.Create));
                }
                var season = _context.Seasons.Find(model.ID);
                season.Titel          = model.Titel;
                season.Nr             = model.Nr;
                season.SerieID        = model.SerieID;
                season.Rating         = model.Rating;
                season.YoutubeTrailer = model.YoutubeTrailer;
                if (model.Photo != null)
                {
                    season.PhotoPath = uniqueFileName;
                }
                _context.Update(season);
                await _context.SaveChangesAsync();
            }
            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> Edit(MusicViewModels model)
        {
            string uniqueFileName = null;

            if (ModelState.IsValid)
            {
                if (model.Photo != null)
                {
                    string UploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "images");
                    uniqueFileName = GetUniqueFilmName(model.Photo.FileName);
                    string filePath = Path.Combine(UploadsFolder, uniqueFileName);
                    model.Photo.CopyTo(new FileStream(filePath, FileMode.Create));
                }
                var music = _context.Musics.Find(model.ID);
                music.Lenght         = model.Lenght;
                music.ReleaseDate    = model.ReleaseDate;
                music.Titel          = model.Titel;
                music.WantToListen   = model.WantToListen;
                music.Listened       = model.Listened;
                music.YoutubeTrailer = model.YoutubeTrailer;
                if (model.Photo != null)
                {
                    music.PhotoPath = uniqueFileName;
                }
                _context.Update(music);
                await _context.SaveChangesAsync();
            }
            return(RedirectToAction(nameof(Index)));
        }
示例#3
0
        public async Task <IActionResult> Edit(MusicWriterViewModel model)
        {
            if (ModelState.IsValid)
            {
                string uniqueFileName = null;
                if (model.Photo != null)
                {
                    string UploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "images");
                    uniqueFileName = GetUniqueFilmName(model.Photo.FileName);
                    string filePath = Path.Combine(UploadsFolder, uniqueFileName);
                    model.Photo.CopyTo(new FileStream(filePath, FileMode.Create));
                }
                var writer = await _context.MusicWriters.FindAsync(model.ID);

                writer.Name        = model.Name;
                writer.MusicID     = model.MusicID;
                writer.DateOfBirth = model.DateOfBirth;
                if (model.Photo != null)
                {
                    writer.PhotoPath = uniqueFileName;
                }
                _context.Update(writer);
                await _context.SaveChangesAsync();
            }
            ViewData["MusicsID"] = new SelectList(_context.Musics, "ID", "Titel");
            return(RedirectToAction(nameof(Index)));
        }
示例#4
0
 public async Task <IActionResult> Edit(MoviePlaylistViewModel model)
 {
     if (ModelState.IsValid)
     {
         var moviePlaylist = _context.MoviePlaylists.Find(model.ID);
         moviePlaylist.Naam = model.Naam;
         _context.Update(moviePlaylist);
         await _context.SaveChangesAsync();
     }
     return(RedirectToAction(nameof(Index)));
 }
 public async Task <IActionResult> Edit(SerieViewModel model)
 {
     if (ModelState.IsValid)
     {
         var serie = _context.Series.Find(model.ID);
         serie.Titel = model.Titel;
         _context.Update(serie);
         await _context.SaveChangesAsync();
     }
     return(RedirectToAction(nameof(Index)));
 }
 public async Task <IActionResult> Edit(int id, MovieDirectorEditViewModel model)
 {
     if (ModelState.IsValid)
     {
         var director = _context.Directors.Find(id);
         director.MovieID     = model.MovieID;
         director.Name        = model.Name;
         director.DateOfBirth = model.DateOfBirth;
         _context.Update(director);
         await _context.SaveChangesAsync();
     }
     ViewData["MovieID"] = new SelectList(_context.Movies, "ID", "Titel", model.MovieID);
     return(RedirectToAction(nameof(Index)));
 }
        public async Task <IActionResult> Edit(MusicPlaylistViewModel model)
        {
            if (ModelState.IsValid)
            {
                var musicPlaylist = await _context.MusicPlaylists.Include(m => m.User)
                                    .FirstOrDefaultAsync(m => m.ID == model.ID);

                musicPlaylist.Naam   = model.Naam;
                musicPlaylist.Public = model.Public;
                _context.Update(musicPlaylist);
                await _context.SaveChangesAsync();
            }
            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> Edit(MusicGenreViewModel model)
        {
            if (ModelState.IsValid)
            {
                var genre = await _context.MusicGenres.FindAsync(model.ID);

                genre.Naam    = model.Naam;
                genre.MusicID = model.MusicID;
                _context.Update(genre);
                await _context.SaveChangesAsync();
            }
            ViewData["MusicsID"] = new SelectList(_context.Musics, "ID", "Titel");
            return(RedirectToAction(nameof(Index)));
        }
 public async Task <IActionResult> Edit(int id, MovieReviewEditViewModel model)
 {
     if (ModelState.IsValid)
     {
         var review = context.Reviews.Find(id);
         review.MovieID = model.MovieID;
         review.Rating  = model.Rating;
         review.Comment = model.Comment;
         review.MovieID = model.MovieID;
         context.Update(review);
         await context.SaveChangesAsync();
     }
     ViewData["MovieID"] = new SelectList(context.Movies, "ID", "Titel", model.MovieID);
     return(RedirectToAction(nameof(Index)));
 }
示例#10
0
        public async Task <IActionResult> Edit(MusicReviewViewModel model)
        {
            if (ModelState.IsValid)
            {
                var review = await _context.MusicReviews.FindAsync(model);

                review.Rating   = model.Rating;
                review.Comment  = model.Comment;
                review.MusicsID = model.MusicID;
                _context.Update(review);
                await _context.SaveChangesAsync();
            }
            ViewData["MusicsID"] = new SelectList(_context.Musics, "ID", "Titel");
            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> Edit(EpisodesViewModel model)
        {
            if (ModelState.IsValid)
            {
                var episode = await _context.Episodes.FindAsync(model.ID);

                episode.Length   = model.Length;
                episode.Titel    = model.Titel;
                episode.SeasonID = model.SeasonID;
                episode.Nr       = model.Nr;
                _context.Update(episode);
                await _context.SaveChangesAsync();
            }
            ViewData["SeasonID"] = new SelectList(_context.Seasons, "ID", "ID");
            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> Edit(int id, MovieGenreEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                var genre = context.Genres.Find(id);
                genre.MovieID = model.MovieID;
                genre.Naam    = model.Naam;
                context.Update(genre);
                await context.SaveChangesAsync();


                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MovieID"] = new SelectList(context.Movies, "ID", "Titel", model.MovieID);
            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> Edit(MusicAlbumViewModel model)
        {
            string uniqueFileName = null;

            if (ModelState.IsValid)
            {
                if (model.Photo != null)
                {
                    string UploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "images");
                    uniqueFileName = GetUniqueFilmName(model.Photo.FileName);
                    string filePath = Path.Combine(UploadsFolder, uniqueFileName);
                    model.Photo.CopyTo(new FileStream(filePath, FileMode.Create));
                }
                var album = _context.Albums.Find(model.ID);
                album.Naam = model.Naam;
                if (model.Photo != null)
                {
                    album.PhotoPath = uniqueFileName;
                }
                _context.Update(album);
                await _context.SaveChangesAsync();
            }
            return(RedirectToAction(nameof(Index)));
        }