0
In the controller I have my session built.
public const string ListaPermissao_SessionName = "ListaPermissao";
private List<ListaPermissao> ListaPermissaoEnvio
{
get
{
if (Session[ListaPermissao_SessionName] == null)
Session[ListaPermissao_SessionName] = new List<ListaPermissao>();
return (List<ListaPermissao>)Session[ListaPermissao_SessionName];
}
set
{
Session[ListaPermissao_SessionName] = (List<ListaPermissao>)value;
}
}
Class Listpermission:
public class ListaPermissao
{
public ListaPermissao()
{
this.editado = false;
}
public int id { get; set; }
public bool value { get; set; }
public bool editado { get; set; }
}
At some point I need to recover a list of other objects, but to validate the @checked attribute I need to check this list/session.
var employees = from e in this.context.PermissaoGrupo.Where(x => x.IdGrupo == idGrupo && x.Ativo)
where (id.HasValue ? e.Permissao.IdPermissaoPai == id : e.Permissao.IdPermissaoPai == null)
select new
{
id = e.IdPermissao,
text = e.Permissao.Descricao,
hasChildren = e.Permissao.Permissao1.Any(),
expanded = e.Permissao.Permissao1.Any(),
ord = e.Permissao.Ordem,
@checked = (idUsuario != 0 ? ListaPermissaoEnvio.Any(x => x.id == e.IdPermissaoGrupo && x.value) : false),
idPermissaoGrupo = e.IdPermissaoGrupo
};
The following error is returned:
Could not parse type 'Listpermission[]' because it does not have any known mapping to the value layer.
Thanks in advance.