A simple question but I do not give. I have a many to many relationship between two Citizen entities and Topics (which is generated from the Citizen, Topics and CitizensTopics tables)
And I have a Web-Api service from which I want to obtain the Topics to which a citizen is subscribed. For this I use a method (which does not work)
public IQueryable<Topic> GetTopics(string Ciudadano)
{
db.Configuration.LazyLoadingEnabled = false;
Ciudadano c = db.Ciudadanos.Include("RTopics").FirstOrDefault(p => p.Id == Ciudadano);
return c.RTopics.AsQueryable();
// return db.Topics.Where(p => p.eliminado == false).OrderBy(o => o.nombreTopic); //ESTO SI FUNCIONA
}
This returns an error 500, although in RTopics is the list of Topics to which the citizen in question subscribes.
What's wrong?
Thank you very much