public IEnumerable <Employee> GetEmployee() { using (SLKHUB_DBContext dbContext = new SLKHUB_DBContext()) { return(dbContext.Employees.ToList()); } }
public IEnumerable <Customer> GetCustomers() { using (SLKHUB_DBContext dbContext = new SLKHUB_DBContext()) { return(dbContext.Customers.ToList()); } }
public Employee Get(int id) { using (SLKHUB_DBContext dbContext = new SLKHUB_DBContext()) { return(dbContext.Employees.FirstOrDefault(e => e.ID == id)); } }
public IHttpActionResult GetCustomersById(int id) { using (SLKHUB_DBContext dbContext = new SLKHUB_DBContext()) { //return dbContext.Customers.FirstOrDefault(e => e.Cust_Id == id); Customer customer = dbContext.Customers.Find(id); if (customer == null) { return(NotFound()); } return(Ok(customer)); } }
public IHttpActionResult GetEmployeeById(int id) { using (SLKHUB_DBContext dbContext = new SLKHUB_DBContext()) { // return dbContext.Employees.Find(id); Employee employee = dbContext.Employees.Find(id); if (employee == null) { return(NotFound()); } return(Ok(employee)); } }