Exemplo n.º 1
0
        public async Task <CustomerInfo> FindCustomer(QueryCustomer query)
        {
            Customer customer = await _customerRepo.ReadAsync(query.Id);

            if (customer == null)
            {
                return(null);
            }

            Address primaryAddress = customer.GetPrimaryAddress();

            var info = new CustomerInfo
            {
                Customer = customer
            };

            if (query.IncludedSuggestions && primaryAddress != null)
            {
                info.Suggestions = await _suggestionRepo.LookupSuggestedAutos(primaryAddress.State, customer.Age);
            }

            return(info);
        }