public void Handle(InsertVolumeCustomers command) { var faker = new Faker(); var list = new List <Domain.Models.Customer>(); for (var i = 0; i < command.InsertsCount; i++) { var minDate = DateTime.Now.AddYears(-30); var maxDate = DateTime.Now.AddYears(-60); var customer = new Domain.Models.Customer( faker.Name.FirstName(), faker.Name.LastName(), faker.Person.Email, faker.Date.Between(minDate, maxDate)); customer.Score = faker.Random.Int(0, 100); var address = new Address(faker.Address.StreetName(), faker.Address.BuildingNumber(), faker.Address.City(), faker.Address.ZipCode()); customer.Address = address; list.Add(customer); } list.ForEach(_ => _architectureContext.Add(_)); _architectureContext.SaveChanges(); }
public void Handle(InsertVolumeCustomers command) { var faker = new Faker(); var idCustomer = Guid.NewGuid(); var list = new List <CreateCustomer>(); for (var i = 0; i < command.InsertsCount; i++) { var minDate = DateTime.Now.AddYears(-30); var maxDate = DateTime.Now.AddYears(-60); var customer = new CreateCustomer { FirstName = faker.Name.FirstName(), LastName = faker.Name.LastName(), Email = faker.Person.Email, BirthDate = faker.Date.Between(minDate, maxDate), Street = faker.Address.StreetName(), Number = faker.Address.BuildingNumber(), City = faker.Address.City(), ZipCode = faker.Address.ZipCode() }; list.Add(customer); } list.ForEach(_ => SaveCustomer(_, Guid.NewGuid())); return; }