public Dtos.GetCustomersOutput GetCustomers(Dtos.GetCustomerInput input) { if (input.CustomerId != null) { //TODO: Get unique CreditsHero requests' emails for passed in email. var customers = _customerRepository.GetCustomersByUserId(input.CustomerId.Value); return new Dtos.GetCustomersOutput { Customers = Mapper.Map<List<Dtos.CustomerDto>>(customers) }; } else { if (input.CompanyId.HasValue) { //TODO: Get list of unique CreditsHero requests' emails. CreditsHero.Customers.Dtos.GetCustomersInput inputCustomer = new CreditsHero.Customers.Dtos.GetCustomersInput() { CompanyId = input.CompanyId }; CreditsHero.Customers.Dtos.GetCustomersOutput results = new CreditsHero.Customers.Dtos.GetCustomersOutput(); var customersCreditsHero = (GetCustomersOutput)_creditsHeroConnect.CallCreditsHeroService<GetCustomersOutput>( results, inputCustomer, "api/services/app/Customer/GetCustomers"); var customerUsers = _userManager.Users.Where(u => results.Customers.Any(a => a.Email == u.EmailAddress)); //results.Customers.Where(c => _userManager.Users.Contains(c.Email)); Dtos.GetCustomersOutput customerList = new Dtos.GetCustomersOutput(); foreach(var item in results.Customers) { Dtos.CustomerDto customer = new Dtos.CustomerDto(); customer.CellPhone = item.SmsNumber; customer.Email = item.Email; customer.FullName = item.FullName; customerList.Customers.Add(customer); } return customerList; } } return null; }