Esempio n. 1
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                CityType = htmlHelper.GetEnumSelectList <CityType>();
                return(Page());
            }

            if (City.Id > 0)
            {
                cityData.Update(City);
            }
            else
            {
                cityData.Add(City);
            }
            cityData.Commit();
            TempData["Message"] = "City saved!";
            return(RedirectToPage("./Detail", new { cityId = City.Id }));
        }