public IActionResult ProcessNinja(Ninja data) { if (ModelState.IsValid) { ninjaFactory.Add(data); return(RedirectToAction("Ninjas")); } return(RedirectToAction("Ninjas")); }
public IActionResult AddNinja(Ninja ninja) { if (ModelState.IsValid) { _ninjafactory.Add(ninja); return(RedirectToAction("Ninjas")); } return(View("Ninjas")); }
public IActionResult AddNinja(Ninja ninja, int dojo) { if (ModelState.IsValid) { ninja.dojo_id = dojo; ninjaFactory.Add(ninja); return(RedirectToAction("Index")); } ; return(View("Index", ninja)); }
public IActionResult CreateNinja(NinjaModel submission) { if (ModelState.IsValid) { ninjaFactory.Add(submission); return(RedirectToAction("Ninjas")); } else { return(View("Ninjas")); } }
public IActionResult Create(Ninja ninja) { if (ModelState.IsValid) { ninjaFactory.Add(ninja); return(Redirect("/")); } else { return(View("Index")); } }
public IActionResult AddNinja(Ninja ninja) { if (ModelState.IsValid) { ninjaFactory.Add(ninja); return(RedirectToAction("Ninjas")); } ViewBag.ninjas = ninjaFactory.FindAllWithDojo(); ViewBag.rogueNinjas = ninjaFactory.FindAllWithDojoNull(); ViewBag.allDojos = ninjaFactory.FindAllDojos(); return(View("Ninjas")); }
public IActionResult AddNinja(Ninja newNinja) { if (ModelState.IsValid) { ninjaFactory.Add(newNinja); return(RedirectToAction("Index", "Ninja")); } else { ViewBag.Errors = ModelState.Values; // NEED to add errors to View return(RedirectToAction("Index", "Ninja")); } }
public IActionResult ninjaprocess(Ninja ninja) { if (ModelState.IsValid) { ninjaFactory.Add(ninja); return(RedirectToAction("Ninja")); } else { ViewBag.ninjas = ninjaFactory.FindAll(); ViewBag.dojos_list = dojoFactory.FindAll(); return(View("Ninja")); } }
public IActionResult Create(Ninja ninja, int dojo_id) { System.Console.WriteLine(); System.Console.WriteLine(dojo_id); System.Console.WriteLine(); if (dojo_id > 0) { Dojo dojo = dojoFactory.FindByID(dojo_id); ninja.Dojo = dojo; } ninjaFactory.Add(ninja); return(RedirectToAction("Index")); }
public IActionResult addNinja(Ninja ninja) { if (ModelState.IsValid) { ninjaFactory.Add(ninja); return(RedirectToAction("Index")); } else { ViewBag.allDojos = dojoFactory.FindAll(); ViewBag.allNinjas = ninjaFactory.FindAll(); return(View("Index")); } }
public IActionResult addNinja(Ninja item, int dojo_id) { if (ModelState.IsValid) { Dojo dojo = dojoFactory.GetById(dojo_id); item.Dojo = dojo; System.Console.WriteLine(JsonConvert.SerializeObject(item)); ninjaFactory.Add(item); return(RedirectToAction("NinjaHome")); } ViewBag.ninjas = ninjaFactory.GetAll(); ViewBag.dojos = dojoFactory.GetAll(); return(View("ninjas")); }
public IActionResult AddNinja(Ninja ninja, long dojo) { if (!ModelState.IsValid) { ViewBag.Ninjas = ninjaFactory.FindAll(); return(View("Index")); } else { if (dojo == 0) { Dojo AssignedDojo = null; ninjaFactory.Add(ninja, AssignedDojo); return(RedirectToAction("Index")); } else { Dojo AssignedDojo = dojoFactory.FindByID(dojo); ninjaFactory.Add(ninja, AssignedDojo); return(RedirectToAction("Index")); } } }
public IActionResult AddNinja(NinjaDisplay NinjaDisplay) { Ninja Ninja = NinjaDisplay.Ninja; // check for validations if (ModelState.IsValid) { // add to db _ninjaFactory.Add(Ninja); return(RedirectToAction("Ninja")); } else { // display the validation errors NinjaDisplay.AllNinjas = _ninjaFactory.FindAllNinjas(); NinjaDisplay.AllDojos = _dojoFactory.FindAllDojos(); return(View("Ninja", NinjaDisplay)); } }
public IActionResult AddNinja(RegisterViewNinja ninja) { if (ModelState.IsValid) { Ninja NewNinja = new Ninja { name = ninja.name, level = ninja.level, Description = ninja.Description, Dojo_id = ninja.Dojo_id }; ninjaFactory.Add(NewNinja); return(RedirectToAction("Ninjas")); } ViewBag.Ninjas = ninjaFactory.NinjasForDojo(); ViewBag.Dojos = dojoFactory.FindAll(); var test = ninjaFactory.NinjasForDojo(); var test1 = dojoFactory.FindAll(); return(View("Ninjas")); }
public IActionResult CreateNinja(Ninja item, int myDojo) { ninjaFactory.Add(item, myDojo); return(RedirectToAction("NinjaIndex")); }