Exemplo n.º 1
0
 public RedirectToActionResult People(string firstName, string lastName, string birthDate, string deathDate)
 {
     people           = new ImportantPeople();
     people.FirstName = firstName;
     people.LastName  = lastName;
     people.BirthDate = birthDate;
     people.DeathDate = deathDate;
     PeopleRepository.AddPeople(people);
     return(RedirectToAction("People"));
 }
Exemplo n.º 2
0
        public void AddRandomPeople(AddRandomViewModel viewModel)
        {
            var people = Enumerable.Range(1, viewModel.Amount).Select(_ => new Person
            {
                LastName  = Faker.Name.Last(),
                FirstName = Faker.Name.First(),
                Age       = Faker.RandomNumber.Next(viewModel.MinAge, viewModel.MaxAge)
            });

            var repo = new PeopleRepository(_connectionString);

            repo.AddPeople(people);
        }
Exemplo n.º 3
0
        public void AddPeopleRange(AgeRangeViewModel vm)
        {
            var ppl = new List <Person>();

            for (int i = 1; i < vm.Amount; i++)
            {
                ppl.Add(new Person
                {
                    FirstName = Faker.Name.First(),
                    LastName  = Faker.Name.Last(),
                    Age       = Faker.RandomNumber.Next(vm.Min, vm.Max)
                });
            }
            var repo = new PeopleRepository(_connectionString);

            repo.AddPeople(ppl);
        }
Exemplo n.º 4
0
        public void AddPeople(PeopleVM vm)
        {
            var repo = new PeopleRepository(_connection);

            repo.AddPeople(vm.AgeRange, vm.Amount);
        }