1
I need to select the Groups previously registered, bringing data not repeated. However, an error is returned when performing the query in the table Point of Attendance, where the countryside Group in which the GroupBy
contains null value. How to adjust the code so that it returns no error if the field Group be empty?
OrigemDados = new OrigemDados(
pontoAtendimentoService
.RecuperarTodos(httpContextAccessor.HttpContext.User)
.Select(pontoAtendimento => new { pontoAtendimento.Id, pontoAtendimento.Grupo })
.GroupBy(p => p.Grupo)
.Select(grp => grp.First())
.ToList()
.AsQueryable(),
pontoAtendimento => pontoAtendimento
.GetType()
.GetProperty("Grupo")
.GetValue(pontoAtendimento)
.ToString(),
mapeapeamento);