Esempio n. 1
0
 public List<Products> GetAllProducts()
 {
     using (NorthwindEntities context = new NorthwindEntities())
     {
       var query = from p in context.Products select p;
       return query.ToList();
     }
 }
Esempio n. 2
0
 public Products GetProduct(int id)
 {
     Products prod = new Products();
     using (NorthwindEntities context = new NorthwindEntities())
     {
        prod = (from p in context.Products where p.ProductID == id select p).First();
        return prod;
     }
 }