public async Task <JsonResult> OnGetMun(string DepName) { try { Departamento = await _repositoryDepSV.ListAsync(); Departamento = Departamento.Where(x => x.DepName == DepName); Municipio = await _repositoryMunSV.ListAsync(); Municipio = Municipio.Where(x => x.DEPSV_ID == Departamento.First().ID); if (Municipio == null) { return(new JsonResult(new { selected = true })); } return(new JsonResult(new { Municipio })); } catch (Exception ex) { _logger.LogWarning(ex.Message); throw; } }