I am trying to display a JSON using a JsonResult method in MVC, I am using Entity Framework but my issue is that the PostMan is displaying a server error:
The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
I am using a query which involves 3 different tables, however one of those tables might retrieve more that 3 different rows.
This is my code:
[HttpGet]
[AllowAnonymous]
public JsonResult RetreiveResume(int User)
{
using (var context = new DexusEntities())
{
var collection = (from p in context.CND_PersonalData join
pd in context.CND_ProfessionalData on p.UserId equals pd.UserId join
ex in context.CND_ExperiencesData on p.UserId equals ex.UserId select p).ToList();
return Json(collection, JsonRequestBehavior.AllowGet);
}
}
What's wrong with my code?
Thanks in advance.