public void Delete(Car entity) { using (ReCapDatabaseContext context = new ReCapDatabaseContext()) { var deletedEntity = context.Entry(entity); deletedEntity.State = EntityState.Deleted; context.SaveChanges(); } }
public void Update(Car entity) { using (ReCapDatabaseContext context = new ReCapDatabaseContext()) { var uptadedEntity = context.Entry(entity); uptadedEntity.State = EntityState.Modified; context.SaveChanges(); } }
public void Add(Car entity) { using (ReCapDatabaseContext context = new ReCapDatabaseContext()) { var addedEntity = context.Entry(entity); addedEntity.State = EntityState.Added; context.SaveChanges(); } }