public IActionResult Create(Location location) { if (ModelState.IsValid) { var result = locations.AddLocation(location); if (result) { TempData["message"] = $"Location has been created."; } return(RedirectToAction("List")); } else { return(View(location)); } }
// --------------------------------------------------------------------- // All Location related Session Methods go here /// <summary> /// Adds a location /// </summary> /// <param name="name">Location Name</param> public void AddLocation(string name) => Locations.AddLocation(name);