public ActionResult Create(TournamentCategory model) { if (!ModelState.IsValid) { return View(model); } DataAccess.Categories.Add(model); DataAccess.SaveChanges(); return RedirectToAction("index"); }
public ActionResult Edit(TournamentCategory model) { if (!ModelState.IsValid) { return View(model); } var category = DataAccess.Categories.Find(model.Id); if (category != null) { category.Name = model.Name; DataAccess.SaveChanges(); } return RedirectToAction("index"); }