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")); }
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); }
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); }
public void AddPeople(PeopleVM vm) { var repo = new PeopleRepository(_connection); repo.AddPeople(vm.AgeRange, vm.Amount); }