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