Esempio n. 1
0
 public Employees GetEmployeesByID(int Id)
 {
     using (var dbContext = new WebContextDataBase())
     {
         return(GetList().Where(e => e.EmployeeID == Id).FirstOrDefault());
     }
 }
Esempio n. 2
0
 public List <T> GetList()
 {
     using (var dbContext = new WebContextDataBase())
     {
         return(dbContext.Set <T>().ToList());
     }
 }
Esempio n. 3
0
 public Categories GetCategoryByID(int Id)
 {
     using (var dbContext = new WebContextDataBase())
     {
         return(GetList().Where(c => c.CategoryID == Id).FirstOrDefault());
     }
 }
Esempio n. 4
0
 public Products GetProductsByID(int Id)
 {
     using (var dbContext = new WebContextDataBase())
     {
         return(GetList().Where(p => p.ProductID == Id).FirstOrDefault());
     }
 }
Esempio n. 5
0
 public Customers GetCustomersByID(string Id)
 {
     using (var dbContext = new WebContextDataBase())
     {
         return(GetList().Where(c => c.CustomerID == Id).FirstOrDefault());
     }
 }
Esempio n. 6
0
 public Orders GetOrdersById(int Id)
 {
     using (var dbContext = new WebContextDataBase())
     {
         return(GetList().Where(o => o.OrderID == Id).FirstOrDefault());
     }
 }
Esempio n. 7
0
 public int Update(T entity)
 {
     using (var dbContext = new WebContextDataBase())
     {
         dbContext.Entry(entity).State = EntityState.Modified;
         return(dbContext.SaveChanges());
     }
 }
Esempio n. 8
0
 public int Delete(T entity)
 {
     using (var dbContext = new WebContextDataBase())
     {
         dbContext.Entry(entity).State = EntityState.Deleted;
         return(dbContext.SaveChanges());
     }
     throw new NotImplementedException();
 }