public IActionResult AddNinja(Ninja ninja) { ninjaFactory = new NinjaFactory(); TryValidateModel(ninja); ViewBag.Error = ModelState; ninjaFactory.AddNinja(ninja); return(RedirectToAction("Ninjas")); }
public IActionResult AddNinja(Ninja newninja) { TryValidateModel(newninja); if (ModelState.IsValid) { ninjaFactory.AddNinja(newninja); } return(Redirect("ninja")); }
public IActionResult RegisterNinja(Ninja newNinja) { if (ModelState.IsValid) { ninjaFactory.AddNinja(newNinja); return(RedirectToAction("Success")); } return(View("Index", newNinja)); }
public IActionResult Create(NinjaIndex model) { Ninja ninja = model.NewNinja; if (ModelState.IsValid) { _ninjaFactory.AddNinja(ninja); return(RedirectToAction("Index")); } return(View("Index", new NinjaIndex() { Ninjas = _ninjaFactory.AllNinjas(), Dojos = _dojoFactory.AllDojos(), NewNinja = ninja })); }