public IEnumerable <string> insertMusic(string SingerName, string AlbumName, string MusicFileName, string Description) { if (SingerName == null) { SingerName = ""; } if (MusicFileName == null) { MusicFileName = ""; } if (AlbumName == null) { AlbumName = ""; } if (Description == null) { Description = ""; } using (var db = new MusicDataContext()) { db.Songs.Add(new MusicPlayerMastera { Description = Description, AlbumName = AlbumName, MusicFileName = MusicFileName, SingerName = SingerName }); db.SaveChanges(); } return(new List <string>()); }
public IEnumerable <string> insertAlbum(string AlbumName, string ImageName) { if (AlbumName == null || ImageName == null) { return(new List <string>()); } using (var db = new MusicDataContext()) { db.Albums.Add(new AlbumMastera { AlbumName = AlbumName, ImageName = ImageName }); db.SaveChanges(); } return(new List <string>()); }
public IEnumerable <string> deleteMusic(string MusicPlayerMasteraID) { if (MusicPlayerMasteraID == null) { MusicPlayerMasteraID = "0"; } using (var db = new MusicDataContext()) { var song = db.Songs.FirstOrDefault(s => s.MusicPlayerMasteraID.ToString() == MusicPlayerMasteraID); if (song != null) { db.Songs.Remove(song); db.SaveChanges(); } } return(new List <string>()); }
public IEnumerable <string> updateMusic(string MusicPlayerMasteraID, string SingerName, string AlbumName, string MusicFileName, string Description) { var EmptyList = new List <string>(); if (MusicPlayerMasteraID == null) { return(EmptyList); } if (SingerName == null) { return(EmptyList); } if (MusicFileName == null) { return(EmptyList); } if (AlbumName == null) { return(EmptyList); } if (Description == null) { return(EmptyList); } using (var db = new MusicDataContext()) { var song = db.Songs.FirstOrDefault(s => s.MusicPlayerMasteraID.ToString() == MusicPlayerMasteraID); if (song != null) { song.AlbumName = AlbumName; song.Description = Description; song.MusicFileName = MusicFileName; song.SingerName = SingerName; } db.SaveChanges(); } return(EmptyList); }