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