public ActionResult Create(Category category) { try { if (ModelState.IsValid) { UnitOfWork_.CategoryRepo.AddCategory(category); UnitOfWork_.CategoryRepo.Save(); return RedirectToAction("Index"); } return View(); } catch { return View(); } }
public void AddCategory(Category category) { entities.Category.Add(category); }