public IActionResult Add(AddPersonModel person)
        {
            if (ModelState.IsValid)
            {
                PersonData.AddPerson(person);
                return(RedirectToAction("List"));
            }

            return(View(person));
        }
Exemplo n.º 2
0
        static async Task MainAsync(string connectionString)
        {
            string  fullName            = "Kus";
            decimal winnings            = 200000M;
            string  countryAbbreviation = "USA";

            PersonData.AddPerson(connectionString: connectionString, fullName: fullName, winnings: winnings, countryAbbreviation: countryAbbreviation);

            List <Person> persons = await PersonData.Get(connectionString);

            foreach (Person person in persons)
            {
                System.Console.WriteLine($"Person Name: {person.FullName}. Winnings: {person.Winnings.ToString(System.Globalization.CultureInfo.InvariantCulture)}. Country: {person.Country.Abbreviation}");
            }
        }