private void CreateCustomersInDatabase()
        {
            var customers = new List <Customer>();

            for (int i = 0; i < 100; i++)
            {
                var    title = "Customer " + i;
                Random rand  = new Random();

                customers.Add(new Customer
                {
                    Id    = 1000 + i,
                    Title = title,
                    AuthorizedPersonName = title
                });
            }

            _customerService.AddRange(customers.ToArray());
        }
Пример #2
0
        private void CreateListOfCustomers(int customersCount)
        {
            var listOfCustomers = new List <Customer>();

            for (var i = 0; i < customersCount; i++)
            {
                var countOfTasks = Random.Next(100);
                var customer     = new Customer
                {
                    FirstName     = RandomStringGenerator(Random.Next(2, 10)),
                    LastName      = RandomStringGenerator(Random.Next(2, 10)),
                    Email         = RandomStringGenerator(Random.Next(2, 10)) + "@" + RandomStringGenerator(Random.Next(2, 10)) + "." + RandomStringGenerator(Random.Next(2, 3)),
                    CountOfTasks  = countOfTasks,
                    DurationHours = Random.Next(100),
                    ExecutedTasks = Random.Next(countOfTasks)
                };
                listOfCustomers.Add(customer);
            }
            _customerService.AddRange(listOfCustomers);
        }