public List <Customer> Customer_List() { using (var context = new HTPSContext()) { return(context.Customers.ToList()); } }
// 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)); } }
public Customer Customer_Find(int customerid) { using (var context = new HTPSContext()) { return(context.Customers.Find(customerid)); } }
public List <Product> Product_List() { using (var context = new HTPSContext()) { return(context.Products.ToList()); } }
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()); } }
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()); } }
public Registration Registration_Get(int registrationid) { using (var context = new HTPSContext()) { return(context.Registrations.Find(registrationid)); } }
public List <Registration> Registration_List() { using (var context = new HTPSContext()) { return(context.Registrations.ToList()); } }
// 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()); } }
public int Customer_Add(Customer newcustomer) { using (var context = new HTPSContext()) { context.Customers.Add(newcustomer); context.SaveChanges(); return(newcustomer.CustomerID); } }
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()); } }
// 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); } }