public async Task CreateCustomerAsync()

in src/Relecloud.Web.CallCenter.Api/Services/SqlDatabaseConcertRepository/SqlDatabaseConcertRepository.cs [149:172]


        public async Task<CreateResult> CreateCustomerAsync(Customer newCustomer)
        {
            if (string.IsNullOrEmpty(newCustomer.Email))
            {
                throw new ArgumentNullException(nameof(newCustomer.Email));
            }

            var customer = await this.database.Customers
                .FirstOrDefaultAsync(c => c.Email == newCustomer.Email);
            if (customer == null)
            {
                customer = new Customer
                {
                    Id = newCustomer.Id,
                    Email = newCustomer.Email.ToLower(),
                    Name = newCustomer.Name,
                    Phone = newCustomer.Phone,
                };
                this.database.Customers.Add(customer);
                await this.database.SaveChangesAsync();
            }

            return CreateResult.SuccessResult(customer.Id);
        }