Пример #1
0
        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));
            }
        }
Пример #2
0
        // ---------------------------------------------------------------------
        // 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);