Exemplo n.º 1
0
            public async Task <GetCustomerModel> HandleAsync(GetCustomerFromMsGraf query)
            {
                var customer = await _cspClient.GetCustomerAsync(query.TenantId.ToString());

                var customerDb = await _customerReadRepository.Get(query.TenantId);

                var user = await _userReadRepository.GetFirstByCustomerId(query.TenantId);

                return(new GetCustomerModel
                {
                    Domain = customer?.Domain,
                    Address = customer?.Address,
                    PhoneNumber = customer?.PhoneNumber,
                    City = customer?.City,
                    Country = customer?.Country,
                    PostalCode = customer?.PostalCode,
                    Name = customer?.Name,
                    Margin = customerDb?.Margin,
                    Email = user?.Username
                });
            }