public Product GetProducts(int ID) { using (var Context = new EcContext()) { return(Context.products.Find(ID)); } }
public List <Product> GetProducts() { using (var Context = new EcContext()) { return(Context.products.ToList()); } }
public List <Category> GetCategories() { using (var Context = new EcContext()) { return(Context.Categories.ToList()); } }
public Category GetCategories(int ID) { using (var Context = new EcContext()) { return(Context.Categories.Find(ID)); } }
public void UpdateProduct(Product product) { using (var Context = new EcContext()) { Context.Entry(product).State = System.Data.Entity.EntityState.Modified; Context.SaveChanges(); } }
public void SaveProduct(Product product) { using (var Context = new EcContext()) { Context.products.Add(product); Context.SaveChanges(); } }
public void UpdateCategory(Category category) { using (var Context = new EcContext()) { Context.Entry(category).State = System.Data.Entity.EntityState.Modified; Context.SaveChanges(); } }
public void SaveCategory(Category category) { using (var Context = new EcContext()) { Context.Categories.Add(category); Context.SaveChanges(); } }
public void DeleteProduct(int ID) { using (var Context = new EcContext()) { var product = Context.products.Find(ID); //Context.Entry(category).State = System.Data.Entity.EntityState.Modified; Context.products.Remove(product); Context.SaveChanges(); } }
public void DeleteCategory(int ID) { using (var Context = new EcContext()) { var category = Context.Categories.Find(ID); //Context.Entry(category).State = System.Data.Entity.EntityState.Modified; Context.Categories.Remove(category); Context.SaveChanges(); } }