PipefyAddCompanies/Core/UseCases/ProcessadorDeEmpresas.cs

32 lines
882 B
C#

using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using PipefyAddCompanies.Core.Models;
using PipefyAddCompanies.Core.Services;
namespace PipefyAddCompanies.Core.UseCases
{
public class ProcessadorDeEmpresas
{
private readonly PipefyService _pipefyService;
public ProcessadorDeEmpresas(PipefyService pipefyService)
{
_pipefyService = pipefyService;
}
// Método principal para processar as empresas
public async Task ProcessarAsync(IEnumerable<Empresa> Empresas)
{
foreach (Empresa empresa in Empresas)
{
if (!(empresa.ExisteNoPipefy ?? false))
{
await _pipefyService.CriarCardNoPipefy(empresa);
}
}
}
}
}