internal static PlaylistInfo GetPlaylistInfos(int id) { PlaylistInfo info = null; var context = new MyJukeboxEntities(); var result = context.tPlaylists.SingleOrDefault(n => n.ID == id); if (result != null) { return(info = new PlaylistInfo { ID = result.ID, Name = result.Name, Row = result.Row != null ? (int)result.Row : 2, Last = result.Last != null ? (bool)result.Last : false }); } else { return(null); } }
internal static void SetPlaylistInfos(PlaylistInfo playlist) { var context = new MyJukeboxEntities(); var result = context.tPlaylists.SingleOrDefault(n => n.ID == playlist.ID); if (result != null) { if (playlist.Name != null) { result.Name = playlist.Name; } if (playlist.Row != null) { result.Row = playlist.Row; } if (playlist.Last != null) { result.Last = playlist.Last; } context.SaveChanges(); } }