Example #1
0
 public void CategoriesListView_InsertItem(Category category)
 {
     var item = category;
     categories.Add(category);
     if (ModelState.IsValid)
     {
         categories.SaveChanges();
     }
     else
     {
         ModelState.AddModelError("Error", "Invalid Category name");
     }
 }
Example #2
0
 protected int GetNumberOfBooks(Category category)
 {
     return category.Books.Count;
 }