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