public void Delete() { try { GamesDBContext context = new GamesDBContext(); context.Entry(this).State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); } catch (Exception) { throw; } }
public void Save() { bool create = this.id == 0; try { GamesDBContext context = new GamesDBContext(); if (create) { context.Entry(this).State = System.Data.Entity.EntityState.Added; } else { context.Entry(this).State = System.Data.Entity.EntityState.Modified; } context.SaveChanges(); } catch (Exception) { throw; } }