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