Beispiel #1
0
 public Product GetCategory(int id)
 {
     using (BazaarContext context = new BazaarContext())
     {
         return(context.Products.Find(id));
     }
 }
Beispiel #2
0
 public List <Product> GetCategory()
 {
     using (BazaarContext context = new BazaarContext())
     {
         return(context.Products.ToList());
     }
 }
Beispiel #3
0
 public Category GetCategory(int id)
 {
     using (BazaarContext context = new BazaarContext())
     {
         return(context.Categories.Find(id));
     }
 }
Beispiel #4
0
 public List <Category> GetCategory()
 {
     using (BazaarContext context = new BazaarContext())
     {
         return(context.Categories.ToList());
     }
 }
Beispiel #5
0
 public void DeleteCategory(Product product)
 {
     using (BazaarContext context = new BazaarContext())
     {
         context.Entry(product).State = System.Data.Entity.EntityState.Deleted;
         context.SaveChanges();
     }
 }
Beispiel #6
0
 public void SaveCategory(Product product)
 {
     using (BazaarContext context = new BazaarContext())
     {
         context.Products.Add(product);
         context.SaveChanges();
     }
 }
Beispiel #7
0
 public void UpdateCategory(Category category)
 {
     using (BazaarContext context = new BazaarContext())
     {
         context.Entry(category).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
Beispiel #8
0
 public void SaveCategory(Category category)
 {
     using (BazaarContext context = new BazaarContext())
     {
         context.Categories.Add(category);
         context.SaveChanges();
     }
 }
 public ProductController(BazaarContext context)
 {
     _context = context;
 }