public Color Get(Expression <Func <Color, bool> > filter) { using (RecapProjectContext context = new RecapProjectContext()) { return(context.Set <Color>().Where(filter).FirstOrDefault()); } }
public IEnumerable <Color> GetAll(Expression <Func <Color, bool> > filter = null) { using (RecapProjectContext context = new RecapProjectContext()) { return(filter == null?context.Set <Color>().ToList() : context.Set <Color>().Where(filter).ToList()); } }
public IEnumerable <Car> GetAllByColorId(Expression <Func <Car, bool> > filter) { using (RecapProjectContext context = new RecapProjectContext()) { return(context.Set <Car>().Where(filter).ToList()); } }
public void Delete(Color entity) { using (RecapProjectContext context = new RecapProjectContext()) { context.Entry(entity).State = EntityState.Deleted; context.SaveChanges(); } }
public void Update(Brand entity) { using (RecapProjectContext context = new RecapProjectContext()) { context.Entry(entity).State = EntityState.Modified; context.SaveChanges(); } }
public void Add(Car entity) { using (RecapProjectContext context = new RecapProjectContext()) { context.Entry(entity).State = EntityState.Added; context.SaveChanges(); } }