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