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