public async Task <ListAllLeadsOutput> ListAllLeads() { var allLeads = await _leadRepository.ListAllLeads(); var listLeadDto = new List <LeadDto>(); allLeads.ToList().ForEach(async leadEntity => { var leadDto = leadEntity.CreateDto(); var statusEntity = await _leadRepository.GetStatusById(leadEntity.StatusId); leadDto.Status = statusEntity.CreateDto(); listLeadDto.Add(leadDto); }); return(new ListAllLeadsOutput() { Leads = listLeadDto }); }
public async Task <GetLeadOutput> ListLeadByCustomer() { var allUserLeads = await _leadRepository.ListLeadsByCustomer(); List <BasicLeadDto> leadDto = new List <BasicLeadDto>(); foreach (var leadEntity in allUserLeads) { var dto = leadEntity.CreateBasicLeadDto(); var statusEntity = await _leadRepository.GetStatusById(leadEntity.StatusId); dto.Status = statusEntity.CreateDto(); leadDto.Add(dto); } return(new GetLeadOutput { Leads = leadDto }); }