public void Save() { bool create = this.id == 0; try { VideogameContext context = new VideogameContext(); 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; } }
public void Remove() { try { VideogameContext context = new VideogameContext(); context.Entry(this).State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); } catch (Exception) { throw; } }