public Brand Get(Expression <Func <Brand, bool> > filter) { using (RecapContext context = new RecapContext()) { return(context.Set <Brand>().SingleOrDefault(filter)); } }
public List <Brand> GetAll(Expression <Func <Brand, bool> > filter = null) { using (RecapContext context = new RecapContext()) { return(filter == null?context.Set <Brand>().ToList() : context.Set <Brand>().Where(filter).ToList()); } }
public Color Get(Expression <Func <Color, bool> > filter) { using (RecapContext context = new RecapContext()) { return(context.Set <Color>().SingleOrDefault(filter)); } }
public void Update(Brand entity) { using (RecapContext context = new RecapContext()) { var updatedEntity = context.Entry(entity); updatedEntity.State = EntityState.Modified; context.SaveChanges(); } }
public void Delete(Brand entity) { using (RecapContext context = new RecapContext()) { var deletedEntity = context.Entry(entity); deletedEntity.State = EntityState.Deleted; context.SaveChanges(); } }
public void Add(Brand entity) { using (RecapContext context = new RecapContext()) { var addedEntity = context.Entry(entity); addedEntity.State = EntityState.Added; context.SaveChanges(); } }
public void Delete(Color entity) { using (RecapContext context = new RecapContext()) { var deletedColor = context.Entry(entity); deletedColor.State = EntityState.Deleted; context.SaveChanges(); } }
public void Add(Color entity) { using (RecapContext context = new RecapContext()) { var addedColor = context.Entry(entity); addedColor.State = EntityState.Added; context.SaveChanges(); } }