Exemplo n.º 1
0
 public List <Color> GetAll(Expression <Func <Color, bool> > filter = null)
 {
     using (TableContext context = new TableContext())
     {
         return(filter == null?context.Set <Color>().ToList() : context.Set <Color>().Where(filter).ToList());
     }
 }
Exemplo n.º 2
0
 public Color Get(Expression <Func <Color, bool> > filter)
 {
     using (TableContext context = new TableContext())
     {
         return(context.Set <Color>().SingleOrDefault(filter));
     }
 }
Exemplo n.º 3
0
 public Brand Get(Expression <Func <Brand, bool> > filter)
 {
     using (TableContext context = new TableContext())
     {
         return(context.Set <Brand>().SingleOrDefault(filter));
     }
 }
Exemplo n.º 4
0
 public Product Get(Expression <Func <Product, bool> > filter)
 {
     using (TableContext context = new TableContext())
     {
         return(context.Set <Product>().SingleOrDefault(filter));
     }
 }
Exemplo n.º 5
0
 public void Update(Color entity)
 {
     using (TableContext context = new TableContext())
     {
         var updatedEntity = context.Entry(entity);
         updatedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemplo n.º 6
0
 public void Delete(Color entity)
 {
     using (TableContext context = new TableContext())
     {
         var deletedEntity = context.Entry(entity);
         deletedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Exemplo n.º 7
0
 public void Add(Color entity)
 {
     using (TableContext context = new TableContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }