コード例 #1
0
 public List <Customer> Customer_List()
 {
     using (var context = new HTPSContext())
     {
         return(context.Customers.ToList());
     }
 }
コード例 #2
0
 // Returns a single product instance based on the productid
 public Product Product_Find(int productid)
 {
     using (var context = new HTPSContext())
     {
         return(context.Products.Find(productid));
     }
 }
コード例 #3
0
 public Customer Customer_Find(int customerid)
 {
     using (var context = new HTPSContext())
     {
         return(context.Customers.Find(customerid));
     }
 }
コード例 #4
0
 public List <Product> Product_List()
 {
     using (var context = new HTPSContext())
     {
         return(context.Products.ToList());
     }
 }
コード例 #5
0
 public List <Registration> Registration_GetByModelNumber(string modelnumber)
 {
     using (var context = new HTPSContext())
     {
         return(context.Database.SqlQuery <Registration>("Registration_GetByModelNumber @ModelNumber", new SqlParameter("ModelNumber", modelnumber)).ToList());
     }
 }
コード例 #6
0
 public List <Registration> Registration_GetByProduct(int productid)
 {
     using (var context = new HTPSContext())
     {
         return(context.Database.SqlQuery <Registration>("Registration_GetByProduct @ProductID", new SqlParameter("ProductID", productid)).ToList());
     }
 }
コード例 #7
0
 public Registration Registration_Get(int registrationid)
 {
     using (var context = new HTPSContext())
     {
         return(context.Registrations.Find(registrationid));
     }
 }
コード例 #8
0
 public List <Registration> Registration_List()
 {
     using (var context = new HTPSContext())
     {
         return(context.Registrations.ToList());
     }
 }
コード例 #9
0
        // method for updating a product
        public int Product_Update(Product prod)
        {
            using (var context = new HTPSContext())
            {
                context.Entry(prod).State = System.Data.Entity.EntityState.Modified;

                return(context.SaveChanges());
            }
        }
コード例 #10
0
 public int Customer_Add(Customer newcustomer)
 {
     using (var context = new HTPSContext())
     {
         context.Customers.Add(newcustomer);
         context.SaveChanges();
         return(newcustomer.CustomerID);
     }
 }
コード例 #11
0
        public int Product_Delete(Product prod)
        {
            using (var context = new HTPSContext())
            {
                prod.Discontinued         = true;
                prod.DiscontinuedDate     = DateTime.Today;
                context.Entry(prod).State = System.Data.Entity.EntityState.Modified;

                return(context.SaveChanges());
            }
        }
コード例 #12
0
        // method for adding a product
        public int Product_Add(Product prod)
        {
            using (var context = new HTPSContext())
            {
                context.Products.Add(prod);

                context.SaveChanges();

                return(prod.ProductID);
            }
        }