Example #1
0
        private async Task <Customer> GetCustomer(SaleAddClientModel dto)
        {
            // customer
            var existCustomer = await _customerRepository.FindAsync(x => x.ContactId == dto.CustomerId);

            if (existCustomer.FirstOrDefault() == null)
            {
                await _customerRepository.AddAsync(dto.Customer());

                await _customerRepository.CompleteAsync();
            }

            return(existCustomer.FirstOrDefault());
        }