public void UpdateCategory(Category category)
 {
     using (var context = new ECPContext())
     {
         context.Entry(category).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void SaveCategory(Category category)
 {
     using (var context = new ECPContext())
     {
         context.Categories.Add(category);
         context.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void UpdateProduct(Product product)
 {
     using (var context = new ECPContext())
     {
         context.Entry(product).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public void SaveProduct(Product product)
 {
     using (var context = new ECPContext())
     {
         context.Products.Add(product);
         context.SaveChanges();
     }
 }
 public void DeleteCategory(int ID)
 {
     using (var context = new ECPContext())
     {
         var category = context.Categories.Find(ID);
         context.Categories.Remove(category);
         context.SaveChanges();
     }
 }
Exemplo n.º 6
0
 public void DeleteProduct(int ID)
 {
     using (var context = new ECPContext())
     {
         var product = context.Products.Find(ID);
         context.Products.Remove(product);
         context.SaveChanges();
     }
 }