private async Task <List <SelectListItem> > ListarFamiliaAsync() { var familias = await _familiaService.ListarAsync(); if (familias.Any()) { return(familias.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 _familiaService.ListarAsync())); }