public async Task <IEnumerable <AlertaViewModel> > Get() { var data = await _alertaRepository.ObtenerTodasAlertas(); if (data == null) { return(new List <AlertaViewModel>()); } //todo: change to a var and eval null and empty lists return(data.Select(m => new AlertaViewModel { IdAlerta = m.IdAlerta, Nombre = m.Nombre, Descripcion = m.Descripcion, CondicionesAdicionales = m.CondicionesAdicionales.Select(c => new AlertaCondicionAdicionalViewModel { IdCondicionAdicional = c.IdCondicionAdicional, Nombre = c.Nombre }) })); }