public bool DeleteSong(vwSong song)
 {
     try
     {
         using (AudioPlayerEntities context = new AudioPlayerEntities())
         {
             var songToDelete = context.tblSongs.Where(x => x.SongId == song.SongId).FirstOrDefault();
             context.tblSongs.Remove(songToDelete);
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Exception" + ex.Message.ToString());
         return(false);
     }
 }
 /// <summary>
 /// This methods add user to DbSet and save changes to database.
 /// </summary>
 /// <param name="username">Username.</param>
 /// <param name="password">Password.</param>
 /// <returns>True if user is created, false if not.</returns>
 public bool CreateUser(string username, string password)
 {
     try
     {
         using (AudioPlayerEntities context = new AudioPlayerEntities())
         {
             tblUser user = new tblUser
             {
                 Password = password,
                 Username = username
             };
             context.tblUsers.Add(user);
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Exception" + ex.Message.ToString());
         return(false);
     }
 }
 public bool CreateSong(vwUser user, vwSong song)
 {
     try
     {
         using (AudioPlayerEntities context = new AudioPlayerEntities())
         {
             tblSong newSong = new tblSong
             {
                 Author   = song.Author,
                 Duration = song.Duration,
                 Name     = song.Name,
                 UserId   = user.UserId
             };
             context.tblSongs.Add(newSong);
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Exception" + ex.Message.ToString());
         return(false);
     }
 }