예제 #1
0
 public void SaveCategory(Category category)
 {
     using (var context = new DBazarContext())
     {
         context.categories.Add(category);
         context.SaveChanges();
     }
 }
예제 #2
0
 public void DeleteCategory(Category category)
 {
     using (var context = new DBazarContext())
     {
         // context.Entry(category).State = System.Data.Entity.EntityState.Modified;
         category = context.categories.Find(category.ID);
         context.categories.Remove(category);
         context.SaveChanges();
     }
 }