Exemplo n.º 1
0
 public List <T> GetRange(Expression <Func <T, bool> > condition)
 {
     using (var context = new BakeshoppeInventorySystem())
     {
         var records = context.Set <T>().Where(condition).ToList();
         return(records);
     }
 }
Exemplo n.º 2
0
 public T Get(Expression <Func <T, bool> > condition)
 {
     using (var context = new BakeshoppeInventorySystem())
     {
         var record = context.Set <T>().FirstOrDefault(condition);
         return(record);
     }
 }
Exemplo n.º 3
0
 public void Update(T record)
 {
     using (var context = new BakeshoppeInventorySystem())
     {
         context.Entry(record).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public void Remove(T record)
 {
     using (var context = new BakeshoppeInventorySystem())
     {
         context.Entry(record).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public List <T> GetRange()
 {
     using (var context = new BakeshoppeInventorySystem())
     {
         var records = context.Set <T>().ToList();
         return(records);
     }
 }
Exemplo n.º 6
0
 public void UpdateRange(List <T> records)
 {
     using (var context = new BakeshoppeInventorySystem())
     {
         foreach (var record in records)
         {
             context.Entry(record).State = EntityState.Modified;
         }
         context.SaveChanges();
     }
 }