Exemplo n.º 1
0
 public void UpdateCategory(CategoryViewModel categoryViewModel)
 {
     foreach(Category c in categoryViewModel.ListCategory)
     {
         db.Entry(c).State = EntityState.Modified;
     }
     try
     {
         db.SaveChanges();
     }
     catch(Exception e)
     {
         log.Error("Error Update Category : " + e.Message, e);
     }
 }
Exemplo n.º 2
0
 public void InsertCategory(CategoryViewModel categoryViewModel)
 {
     List<Category> lCategory = categoryViewModel.ListCategory;
     foreach(Category c in lCategory)
     {
         db.Category.Add(c);
     }
     try
     {
         db.SaveChanges();
     }
     catch(Exception e)
     {
         log.Error("Error Insert Category : " + e.Message, e);
     }
 }