using System.Collections.Generic; using Pipefy.Models; namespace Pipefy.Services { public class BusinessLogicService : IBusinessLogicService { public List CompareData(List databaseData, List jsonList, List jsonListGestores) { if (jsonList == null || jsonListGestores == null) { return databaseData; } List recordsMissingInJson = new List(); foreach (var record in databaseData) { bool exists = false; for (var j = 0; j < jsonList.Count; j++) { if (jsonList[j].c_digo_smart!.ToString().Replace(".0", "") == record.c_digo_smart!.ToString()) { exists = true; break; } } if (!exists) { record.gestores = FindGestores(record.gestores!, jsonListGestores); if (record.gestores != "0") { recordsMissingInJson.Add(record); } } } return recordsMissingInJson; } public string FindGestores(string sCodigo, List jsonListGestores) { for (var i = 0; i < jsonListGestores.Count; i++) { if (sCodigo == jsonListGestores[i].gestores!.ToString()) { return jsonListGestores[i].id!; } } return "0"; } } }