public void DeleteOwnsong(int id) { using (AppDatabase context = new AppDatabase(AppDatabase.DBConnectionString)) { IQueryable <vsb_ownsong> entityQuery = from own in context.OwnSongs where own.ID.Equals(id) select own; vsb_ownsong entityToDelete = entityQuery.FirstOrDefault(); context.OwnSongs.DeleteOnSubmit(entityToDelete); context.SubmitChanges(); } }
public void UpdateOwnSong(int id, String title, string content) { using (AppDatabase context = new AppDatabase(AppDatabase.DBConnectionString)) { IQueryable <vsb_ownsong> entityQuery = from own in context.OwnSongs where own.ID == id select own; vsb_ownsong entityToUpdate = entityQuery.FirstOrDefault(); entityToUpdate.Title = title; entityToUpdate.Content = content; context.SubmitChanges(); } }
public void AddOwnSong(String title, String content) { using (AppDatabase context = new AppDatabase(AppDatabase.DBConnectionString)) { vsb_ownsong ownsong = new vsb_ownsong(); ownsong.Title = title; ownsong.Content = content; context.OwnSongs.InsertOnSubmit(ownsong); context.SubmitChanges(); } }