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