Exemplo n.º 1
0
        public ActionResult Create(TournamentCategory model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            DataAccess.Categories.Add(model);
            DataAccess.SaveChanges();

            return RedirectToAction("index");
        }
Exemplo n.º 2
0
        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");
        }