public IActionResult IniciarRastreioBLHouse([FromBody] BlHouse bl) { if (bl.NR_BL == null) { var listBLHouse = _repositorio_bl_house.GetAllDadosBlHouse(); foreach (var item in listBLHouse) { if (item.BL_TOKEN == null || item.BL_TOKEN == "") { bl = new BlHouse { NR_BL = item.NR_BL, ID_ARMADOR_LOGCOMEX = item.ID_ARMADOR_LOGCOMEX, }; var token_ = _servico_logcomex.IniciarRastreioBLHouseLogComex(bl); if (token_ != "") { bl.BL_TOKEN = token_; _repositorio_bl_house.CadastrarTokenBLHouse(bl); _servico_logcomex.AtualizarRastreamentoLogComex(bl.BL_TOKEN); } } else { bl = new BlHouse { NR_BL = bl.NR_BL, BL_TOKEN = bl.BL_TOKEN, }; _servico_logcomex.AtualizarRastreamentoLogComex(bl.BL_TOKEN); } } } else { var token__ = _servico_logcomex.IniciarRastreioBLHouseLogComex(bl); if (token__ != "") { try { bl.BL_TOKEN = token__; _servico_logcomex.AtualizarRastreamentoLogComex(bl.BL_TOKEN); _repositorio_bl_house.CadastrarTokenBLHouse(bl); } catch (Exception ex) { throw ex; } } } return(Ok()); }
public List <BlHouse> ListarBlsHouse() { return(_blhouseRepositorio.GetAllDadosBlHouse()); }