public static void Delete(VideoGame g) { using (var context = new VideoGameContext()) { context.Entry(g).State = EntityState.Deleted; context.SaveChanges(); } }
public static VideoGame Update(VideoGame g) { using (var context = new VideoGameContext()) { context.Entry(g).State = EntityState.Modified; context.SaveChanges(); return(g); } }
public static void Delete(int id) { using (var context = new VideoGameContext()) { VideoGame gameToDelete = (from g in context.VideoGames where g.GameId == id select g).Single(); context.Entry(gameToDelete).State = EntityState.Deleted; context.SaveChanges(); } }