public void DeleteFavourite(int id) { using (AppDatabase context = new AppDatabase(AppDatabase.DBConnectionString)) { IQueryable <vsb_favourite> entityQuery = from fav in context.Favourites where fav.ID.Equals(id) select fav; vsb_favourite entityToDelete = entityQuery.FirstOrDefault(); context.Favourites.DeleteOnSubmit(entityToDelete); context.SubmitChanges(); } }
public void FavoriteThis(String title, String content) { using (AppDatabase context = new AppDatabase(AppDatabase.DBConnectionString)) { vsb_favourite favour = new vsb_favourite(); favour.Title = title; favour.Content = content; context.Favourites.InsertOnSubmit(favour); context.SubmitChanges(); } }