public void Create(CourtsViewModel db) { var entity = new Courts_Table(); entity.CourtsName = db.CourtsName; entities.Courts_Table.Add(entity); entities.SaveChanges(); db.CourtsID = entity.CourtsID; }
public void Destroy(CourtsViewModel db) { var entity = new Courts_Table(); entity.CourtsID = db.CourtsID; entities.Courts_Table.Attach(entity); entities.Courts_Table.Remove(entity); entities.SaveChanges(); }
public void Update(CourtsViewModel db) { var entity = new Courts_Table(); entity.CourtsID = db.CourtsID; entity.CourtsName = db.CourtsName; entities.Courts_Table.Attach(entity); entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); }