public Product GetCategory(int id) { using (BazaarContext context = new BazaarContext()) { return(context.Products.Find(id)); } }
public List <Product> GetCategory() { using (BazaarContext context = new BazaarContext()) { return(context.Products.ToList()); } }
public Category GetCategory(int id) { using (BazaarContext context = new BazaarContext()) { return(context.Categories.Find(id)); } }
public List <Category> GetCategory() { using (BazaarContext context = new BazaarContext()) { return(context.Categories.ToList()); } }
public void DeleteCategory(Product product) { using (BazaarContext context = new BazaarContext()) { context.Entry(product).State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); } }
public void SaveCategory(Product product) { using (BazaarContext context = new BazaarContext()) { context.Products.Add(product); context.SaveChanges(); } }
public void UpdateCategory(Category category) { using (BazaarContext context = new BazaarContext()) { context.Entry(category).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void SaveCategory(Category category) { using (BazaarContext context = new BazaarContext()) { context.Categories.Add(category); context.SaveChanges(); } }
public ProductController(BazaarContext context) { _context = context; }