public IActionResult CreateDojo(Dojo dojo)
 {
     // Checks to see if submitted information is valid
     if (ModelState.IsValid)
     {
         _dojoFactory.AddNewDojo(dojo);
         return(RedirectToAction("Dojos"));
     }
     else
     {
         ViewBag.allDojos = _dojoFactory.DojoList();
         return(View("Dojos"));
     }
 }
Esempio n. 2
0
 public IActionResult DojoCreate(Dojo model)
 {
     if (ModelState.IsValid)
     {
         Dojo newDojo = new Dojo
         {
             Name     = model.Name,
             Location = model.Location,
             Info     = model.Info,
         };
         _dojofactory.AddNewDojo(newDojo);
         return(RedirectToAction("Dojos"));
     }
     ViewBag.allDojos = _dojofactory.GetAllDojos();
     return(View("Dojos"));
 }