예제 #1
0
 public Product GetProduct(int id)
 {
     try
     {
         using (TenisDbEntities db = new TenisDbEntities())
         {
             Product product = db.Products.Find(id);
             return(product);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
예제 #2
0
 public List <Product> GetAllProduct()
 {
     try
     {
         using (TenisDbEntities db = new TenisDbEntities())
         {
             List <Product> products = (from x in db.Products select x).ToList();
             return(products);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }