public async Task <IActionResult> OnPostAsync() { try { if (ModelState.IsValid) { await LoadMunicipios(); var emp = await _empresaApp.ListByLogradouroAsync(Input.Logradouro, Input.Municipio); IEnumerable <BaseReceitaFederal> t = new List <BaseReceitaFederal>(); switch (Input.Situacao) { case "Ativa": t = await _appServiceCNPJ.EmpresasAtivas(emp); break; case "Nula": t = await _appServiceCNPJ.EmpresasNulas(emp); break; case "Suspensa": t = await _appServiceCNPJ.EmpresasSuspensas(emp); break; case "Inapta": t = await _appServiceCNPJ.EmpresasInaptas(emp); break; case "Baixada": t = await _appServiceCNPJ.EmpresasBaixadas(emp); break; case "Geral": t = emp; break; default: break; } Input = new InputModel { ListaEmpresas = t }; } } catch (Exception ex) { StatusMessage = "Erro: " + ex.Message; } return(Page()); }
public async Task <IActionResult> OnPostAsync() { try { if (ModelState.IsValid) { await LoadMunicipios(); var emp = await _empresaApp.ListByLogradouroAsync(Input.Logradouro, Input.Municipio); IEnumerable <BaseReceitaFederal> t = new List <BaseReceitaFederal>(); switch (Input.OptanteSimples) { case "opsimples": t = await _appsimples.OptanteSimplesNacional(emp); break; case "opsimplesnaomei": t = await _appsimples.OptanteSimplesNacionalNaoMEI(emp); break; case "opmei": t = await _appsimples.OptanteMEI(emp); break; case "excsimples": t = await _appsimples.ExclusaoSimplesNacional(emp); break; case "excsimplesmei": t = await _appsimples.ExclusaoSimplesNacionalMEI(emp); break; default: break; } IEnumerable <BaseReceitaFederal> v = new List <BaseReceitaFederal>(); switch (Input.Situacao) { case "Ativa": v = await _appServiceCNPJ.EmpresasAtivas(t); break; case "Nula": v = await _appServiceCNPJ.EmpresasNulas(t); break; case "Suspensa": v = await _appServiceCNPJ.EmpresasSuspensas(t); break; case "Inapta": v = await _appServiceCNPJ.EmpresasInaptas(t); break; case "Baixada": v = await _appServiceCNPJ.EmpresasBaixadas(t); break; default: break; } Input = new InputModel { ListaEmpresas = v }; } } catch (Exception ex) { StatusMessage = "Erro: " + ex.Message; } return(Page()); }