public void UpdatePlaylist(int id, Playlist playlist)
 {
     Playlist playlist_to_update = dbContext.Playlists.Find(id);
     playlist_to_update.Name = playlist.Name;
     dbContext.Entry(playlist_to_update).State = EntityState.Modified;
     Save();
 }
 public ActionResult Create(Create model)
 {
     if (ModelState.IsValid)
     {
         Playlist playlist = new Playlist() { Name = model.Name };
         playlistService.InsertPlaylist(playlist);
         return RedirectToAction("Edit", new { id = playlist.PlaylistID });
     }
     return View(model);
 }
 public void InsertPlaylist(Playlist playlist)
 {
     dbContext.Playlists.Add(playlist);
     Save();
 }
 public void PlaylistExistReturnsPlaylist()
 {
     Playlist playlist = new Playlist() { Name = "Test" };
     playlistrepo.InsertPlaylist(playlist);
     Assert.AreSame(playlist, playlistrepo.GetPlaylistByID(playlist.PlaylistID));
 }
 public void PlaylistDoesNotExistReturnsNull()
 {
     Playlist playlist = new Playlist() { Name = "Test" };
     playlistrepo.InsertPlaylist(playlist);
     Assert.AreEqual(null, playlistrepo.GetPlaylistByID(playlist.PlaylistID+1));
 }