public Product GetProductByIdFromDataStore(string id) { using (HalowenEntities data = new HalowenEntities()) { //Get a product from Products of data where ProductID is matched with id parameter return(data.Products.Where(product => product.ProductID == id).FirstOrDefault()); } }
//Implement GetAllProductsFromDataStore public List <Product> GetAllProductsFromDataStore() { using (HalowenEntities data = new HalowenEntities()) { //get all the products from the Collection Products order by name using HalloweenEntities return(data.Products.ToList()); } }