public IActionResult Post(string name, string age, string gender, string color) { if (!string.IsNullOrEmpty(name)) { int number; bool success = Int32.TryParse(age, out number); if (success) { MemoryDatabase.AddItem(new User { Name = name, Age = age, Gender = gender, Color = color }); return(Redirect("/")); } } // <p>Warning</p> return(Redirect("/error")); }