private async Task <List <SelectListItem> > ListarCondominioAsync() { var condominios = await _condominioService.ListarAsync(); if (condominios.Any()) { return(condominios.Select(x => new SelectListItem { Text = x.Nome, Value = x.Id.ToString() }).ToList()); } return(new List <SelectListItem> { new SelectListItem { Text = "Selecione" } }); }
public async Task <IActionResult> Listar() { return(Json(await _condominioService.ListarAsync())); }