Help: I want to load a specific content item

Dec 29, 2014 at 2:04 AM
I have one 2sxc module on page A that lists content items. Part of the listing is a link to a second page B into which I pass the EntityId of the item I want to use there.

So, on page A I have things like: < a href=" http://mysite.com/B?eid=688">Go There</a>

My problem is what to do on page B. I have a Razor script like this:

@using DotNetNuke.Entities.Portals;
@using DotNetNuke.Entities.Tabs;
@using ToSic.Eav;
@using ToSic.Eav.DataSources;

@{
var allJobs = CreateSource<EntityTypeFilter>();
allJobs.TypeName = "hscJob";
allJobs.EntityID = "[QueryString:eid]";
}

Here is the template:
@foreach (var Content in allJobs.List) {
<div>EID:   @Content.EntityId</div>
<div>Job Title: @Content.jobTitle</div>
<div>Joe ID: @Content.jobId]</div>
<div>Job Category: @Content.jobCategory</div>
<div>Job Location: @Content.jobLocation</div>
<div>Date Posted: @Content.jobDatePosted</div>
<div>Job Summary:@Content.jobSummary</div>
}

So ... Is the the correct way to approach this?

Second ... the above template throws an error, the main part of which is:

There was an error while rendering the template: System.Web.HttpCompileException (0x80004005): c:\inetpub\vhosts\mysite.com\httpdocs\Portals\0\2sxc\Content_hscJobViewPosting.cshtml(9): error CS0012: The type 'System.Data.Objects.DataClasses.EntityObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()


I need help with both of these.


Thanks,

Joe
Dec 29, 2014 at 5:27 PM
Answering my own questions (with thanks to Nokiko):

*** I had to add this to web.config: <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

*** Here is the important part of the template:
@using DotNetNuke.Entities.Portals;
@using DotNetNuke.Entities.Tabs;
@using ToSic.Eav;
@using ToSic.Eav.DataSources;

@{
    var allJobs = CreateSource<EntityIdFilter>();
    allJobs.EntityIds = "[QueryString:eid]";
    var n = allJobs.List.FirstOrDefault().Value;
    var Content = AsDynamic(n);
}
Marked as answer by jncraig on 12/29/2014 at 9:27 AM