Help

Razor Compilation Error

Razor Compilation Error

We tried, we really did, but we just can't compile your view.

We're sorry :-(

Graphics courtesy of the awesome Matthew Inman

Error Details

Error compiling template: Views/Shared/Content/_ContentItems.cshtml

Errors:
[CS1061] Line: 17 Column: 106 - 'Crosscards.Data.Models.Cms.Article' does not contain a definition for 'Id' and no extension method 'Id' accepting a first argument of type 'Crosscards.Data.Models.Cms.Article' could be found (are you missing a using directive or an assembly reference?) (show)

Details:
@using Crosscards.Data
@using Crosscards.Data.Extensions
@using Crosscards.Site.Extensions
@using Salem.Ads.DFP
@using Constants = Crosscards.Data.Constants

@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<List<Crosscards.Site.Models.Content.ArticleViewModel>>

<div class="row">
@foreach (var chunk in Model.Chunk(2))
{
<div class="col-xs-12 col-md-6">
@foreach (var articleViewModel in chunk)
{

<div class="panel-gray margin-bottom-large">
<div class="panel-heading" role="tab" id="[email protected]">
<div class="row padding-medium">
<div class="col-xs-12">
<h3 style="margin:5px 0 0 0;">
<a class="ccards-link" href="@this.Request.Url.Absolute(articleViewModel.Article.SeoFullPath)">
@articleViewModel.Article.Title
</a>
</h3>
</div>
</div>
</div>
</div>
}
</div>
}
</div>


<div id="loading-content" style="width:100%; display: none;">
<div class="alert alert-default text-center">
<h5><i class="fa fa-spin fa-circle-o-notch"></i></h5>
</div>
</div>

<div id="next-page" class="row">
<div class="col-md-12">
<a href="@this.ViewBag.htmlNextPage">Next page <i class="fa fa-chevron-right"></i></a>
</div>
</div>

<script id="message-template" type="text/ractive">
{{ #each contents:index }}
<div class="col-md-6 margin-bottom-large">
<div class="panel-gray">
<div class="panel-heading" role="tab" id="heading-{{ id }}">
<div class="row padding-medium">
<div class="col-xs-10">
<h3 style="margin:5px 0 0 0;">
<a class="ccards-link" href="{{ url }}">
{{ title }}
</a>
</h3>
</div>
</div>
</div>
</div>
</div>

{{ /each }}

{{ #if eof }}
<div class="item col-xs-12">
@Html.Partial("Views/Shared/_Footer")
</div>
{{ /if }}
</script>

<script>
$(document).ready(function () {
Ractive.DEBUG = false;

var adsDecorator = function (node, content) {

ractive.set('adCount', ractive.get('adCount') + 1);
var adCount = ractive.get('adCount');

$(node).html('<div id="gpt-ad-' + adCount + '" decorator="ads" class="ad300x250"></div><div class="text-muted ad-label text-center">advertisement</div>');

loadInfiniteAd('gpt-ad-' + adCount);

return {
teardown: function () {
// ...any cleanup work goes here
}
};
}

var $container = $('#message-output');
var $grid = $('#message-output').imagesLoaded(function () {
// init Masonry after all images have loaded
$grid.masonry({
"itemSelector": ".item",
"columnWidth": ".item",
"isAnimated": true,
"transitionDuration": 100,
"transformsEnabled": true
});

var msnry = $grid.data('masonry');

Ractive.decorators.masonryItem.parentNodes = msnry;
});

var ractive = new Ractive({
el: "#message-output",
template: '#message-template',
decorators: {
ads: adsDecorator
},
append: true,
oninit: function () {
this.set({
eof: false,
loading: false,
nextPage: '@this.ViewBag.jsonNextPage',
contents: [],
adCount: 19
});

$("#next-page").hide();
$('img.content').unveil(300, function () {
$grid.imagesLoaded(function () {
$grid.masonry('layout');
});
});
}
});

$(window).bind('scroll', function () {
if ($(window).scrollTop() + 350 >= $(document).height() - $(window).height() && ractive.get("loading") == false) {
if (ractive.get("eof") == true) {
return;
}

var nextPage = ractive.get("nextPage");

ractive.set({ loading: true });
$("#loading-content").show();

$.getJSON(nextPage, function (data) {
ractive.set({ nextPage: data.nextPage });
data.contents.forEach(function (i) {
ractive.push("contents", i);
});
ractive.set({ loading: false });

$("#loading-content").hide();

$('img.content').unveil(300, function () {
$grid.imagesLoaded(function () {
$grid.masonry('layout');
});
});

}).fail(function () {
ractive.set({ eof: true });
$("#loading-content").hide();
ractive.set({ loading: false });

$grid.imagesLoaded(function () {
$grid.masonry('layout');
});
});
}
});

$(".scroll-to-top").click(function () {
$("html,body").animate({ scrollTop: 0 }, 500);
})

});
</script>

Compilation Source:
//------------------------------------------------------------------------------
Line 1: // <auto-generated>
Line 2: // This code was generated by a tool.
Line 3: // Runtime Version:4.0.30319.42000
Line 4: //
Line 5: // Changes to this file may cause incorrect behavior and will be lost if
Line 6: // the code is regenerated.
Line 7: // </auto-generated>
Line 8: //------------------------------------------------------------------------------
Line 9:
Line 10: namespace RazorOutput {
Line 11: using Microsoft.CSharp.RuntimeBinder;
Line 12: using System;
Line 13: using System.IO;
Line 14:
Line 15: #line 1 "roo"
Line 16: using Crosscards.Data;
Line 17:
Line 18: #line default
Line 19: #line hidden
Line 20: using System.Linq;
Line 21:
Line 22: #line 3 "roo"
Line 23: using Crosscards.Site.Extensions;
Line 24:
Line 25: #line default
Line 26: #line hidden
Line 27:
Line 28: #line 4 "roo"
Line 29: using Salem.Ads.DFP;
Line 30:
Line 31: #line default
Line 32: #line hidden
Line 33: using Salem.Search;
Line 34: using Salem.AllPass;
Line 35:
Line 36: #line 2 "roo"
Line 37: using Crosscards.Data.Extensions;
Line 38:
Line 39: #line default
Line 40: #line hidden
Line 41:
Line 42: #line 5 "roo"
Line 43: using Constants = Crosscards.Data.Constants;
Line 44:
Line 45: #line default
Line 46: #line hidden
Line 47: using System.Collections.Generic;
Line 48:
Line 49:
Line 50: public class RazorView : Nancy.ViewEngines.Razor.NancyRazorViewBase<List<Crosscards.Site.Models.Content.ArticleViewModel>> {
Line 51:
Line 52: #line hidden
Line 53:
Line 54: public RazorView() {
Line 55: }
Line 56:
Line 57: public override void Execute() {
Line 58: WriteLiteral("\r\n");
Line 59:
Line 60: WriteLiteral("<div");
Line 61:
Line 62: WriteLiteral(" class=\"row\"");
Line 63:
Line 64: WriteLiteral(">\r\n");
Line 65:
Line 66:
Line 67: #line 10 "roo"
Line 68:
Line 69:
Line 70: #line default
Line 71: #line hidden
Line 72:
Line 73: #line 10 "roo"
Line 74: foreach (var chunk in Model.Chunk(2))
Line 75: {
Line 76:
Line 77:
Line 78: #line default
Line 79: #line hidden
Line 80: WriteLiteral(" <div");
Line 81:
Line 82: WriteLiteral(" class=\"col-xs-12 col-md-6\"");
Line 83:
Line 84: WriteLiteral(">\r\n");
Line 85:
Line 86:
Line 87: #line 13 "roo"
Line 88:
Line 89:
Line 90: #line default
Line 91: #line hidden
Line 92:
Line 93: #line 13 "roo"
Line 94: foreach (var articleViewModel in chunk)
Line 95: {
Line 96:
Line 97:
Line 98:
Line 99: #line default
Line 100: #line hidden
Line 101: WriteLiteral(" <div");
Line 102:
Line 103: WriteLiteral(" class=\"panel-gray margin-bottom-large\"");
Line 104:
Line 105: WriteLiteral(">\r\n <div");
Line 106:
Line 107: WriteLiteral(" class=\"panel-heading\"");
Line 108:
Line 109: WriteLiteral(" role=\"tab\"");
Line 110:
Line 111: WriteAttribute("id", Tuple.Create(" id=\"", 577), Tuple.Create("\"", 618)
Line 112: , Tuple.Create(Tuple.Create("", 582), Tuple.Create("heading-", 582), true)
Line 113:
Line 114: #line 17 "roo"
Line 115: , Tuple.Create(Tuple.Create("", 590), Tuple.Create<System.Object, System.Int32>(articleViewModel.Article.Id
Line 116:
Line 117: #line default
Line 118: #line hidden
Line 119: , 590), false)
Line 120: );
Line 121:
Line 122: WriteLiteral(">\r\n <div");
Line 123:
Line 124: WriteLiteral(" class=\"row padding-medium\"");
Line 125:
Line 126: WriteLiteral(">\r\n <div");
Line 127:
Line 128: WriteLiteral(" class=\"col-xs-12\"");
Line 129:
Line 130: WriteLiteral(">\r\n <h3");
Line 131:
Line 132: WriteLiteral(" style=\"margin:5px 0 0 0;\"");
Line 133:
Line 134: WriteLiteral(">\r\n <a");
Line 135:
Line 136: WriteLiteral(" class=\"ccards-link\"");
Line 137:
Line 138: WriteAttribute("href", Tuple.Create(" href=\"", 855), Tuple.Create("\"", 926)
Line 139:
Line 140: #line 21 "roo"
Line 141: , Tuple.Create(Tuple.Create("", 862), Tuple.Create<System.Object, System.Int32>(this.Request.Url.Absolute(articleViewModel.Article.SeoFullPath)
Line 142:
Line 143: #line default
Line 144: #line hidden
Line 145: , 862), false)
Line 146: );
Line 147:
Line 148: WriteLiteral(">\r\n");
Line 149:
Line 150: WriteLiteral(" ");
Line 151:
Line 152:
Line 153: #line 22 "roo"
Line 154: Write(articleViewModel.Article.Title);
Line 155:
Line 156:
Line 157: #line default
Line 158: #line hidden
Line 159: WriteLiteral("\r\n </a>\r\n </h3>" +
Line 160: "\r\n </div>\r\n </div>\r\n " +
Line 161: " </div>\r\n </div>\r\n");
Line 162:
Line 163:
Line 164: #line 29 "roo"
Line 165: }
Line 166:
Line 167:
Line 168: #line default
Line 169: #line hidden
Line 170: WriteLiteral(" </div>\r\n");
Line 171:
Line 172:
Line 173: #line 31 "roo"
Line 174: }
Line 175:
Line 176:
Line 177: #line default
Line 178: #line hidden
Line 179: WriteLiteral("</div>\r\n\r\n\r\n<div");
Line 180:
Line 181: WriteLiteral(" id=\"loading-content\"");
Line 182:
Line 183: WriteLiteral(" style=\"width:100%; display: none;\"");
Line 184:
Line 185: WriteLiteral(">\r\n <div");
Line 186:
Line 187: WriteLiteral(" class=\"alert alert-default text-center\"");
Line 188:
Line 189: WriteLiteral(">\r\n <h5><i");
Line 190:
Line 191: WriteLiteral(" class=\"fa fa-spin fa-circle-o-notch\"");
Line 192:
Line 193: WriteLiteral("></i></h5>\r\n </div>\r\n</div>\r\n\r\n<div");
Line 194:
Line 195: WriteLiteral(" id=\"next-page\"");
Line 196:
Line 197: WriteLiteral(" class=\"row\"");
Line 198:
Line 199: WriteLiteral(">\r\n <div");
Line 200:
Line 201: WriteLiteral(" class=\"col-md-12\"");
Line 202:
Line 203: WriteLiteral(">\r\n <a");
Line 204:
Line 205: WriteAttribute("href", Tuple.Create(" href=\"", 1526), Tuple.Create("\"", 1559)
Line 206:
Line 207: #line 43 "roo"
Line 208: , Tuple.Create(Tuple.Create("", 1533), Tuple.Create<System.Object, System.Int32>(this.ViewBag.htmlNextPage
Line 209:
Line 210: #line default
Line 211: #line hidden
Line 212: , 1533), false)
Line 213: );
Line 214:
Line 215: WriteLiteral(">Next page <i");
Line 216:
Line 217: WriteLiteral(" class=\"fa fa-chevron-right\"");
Line 218:
Line 219: WriteLiteral("></i></a>\r\n </div>\r\n</div>\r\n\r\n<script");
Line 220:
Line 221: WriteLiteral(" id=\"message-template\"");
Line 222:
Line 223: WriteLiteral(" type=\"text/ractive\"");
Line 224:
Line 225: WriteLiteral(@">
Line 226: {{ #each contents:index }}
Line 227: <div class=""col-md-6 margin-bottom-large"">
Line 228: <div class=""panel-gray"">
Line 229: <div class=""panel-heading"" role=""tab"" id=""heading-{{ id }}"">
Line 230: <div class=""row padding-medium"">
Line 231: <div class=""col-xs-10"">
Line 232: <h3 style=""margin:5px 0 0 0;"">
Line 233: <a class=""ccards-link"" href=""{{ url }}"">
Line 234: {{ title }}
Line 235: </a>
Line 236: </h3>
Line 237: </div>
Line 238: </div>
Line 239: </div>
Line 240: </div>
Line 241: </div>
Line 242:
Line 243: {{ /each }}
Line 244:
Line 245: {{ #if eof }}
Line 246: <div class=""item col-xs-12"">
Line 247: ");
Line 248:
Line 249: WriteLiteral(" ");
Line 250:
Line 251:
Line 252: #line 69 "roo"
Line 253: Write(Html.Partial("Views/Shared/_Footer"));
Line 254:
Line 255:
Line 256: #line default
Line 257: #line hidden
Line 258: WriteLiteral("\r\n </div>\r\n {{ /if }}\r\n</script>\r\n\r\n<script>\r\n $(document).ready(functio" +
Line 259: "n () {\r\n Ractive.DEBUG = false;\r\n\r\n var adsDecorator = function (n" +
Line 260: "ode, content) {\r\n\r\n ractive.set(\'adCount\', ractive.get(\'adCount\') + 1" +
Line 261: ");\r\n var adCount = ractive.get(\'adCount\');\r\n\r\n $(node).htm" +
Line 262: "l(\'<div id=\"gpt-ad-\' + adCount + \'\" decorator=\"ads\" class=\"ad300x250\"></div><div" +
Line 263: " class=\"text-muted ad-label text-center\">advertisement</div>\');\r\n\r\n l" +
Line 264: "oadInfiniteAd(\'gpt-ad-\' + adCount);\r\n\r\n return {\r\n tea" +
Line 265: "rdown: function () {\r\n // ...any cleanup work goes here\r\n " +
Line 266: " }\r\n };\r\n }\r\n\r\n var $container = $(\'#message" +
Line 267: "-output\');\r\n var $grid = $(\'#message-output\').imagesLoaded(function () {\r" +
Line 268: "\n // init Masonry after all images have loaded\r\n $grid.mas" +
Line 269: "onry({\r\n \"itemSelector\": \".item\",\r\n \"columnWidth\":" +
Line 270: " \".item\",\r\n \"isAnimated\": true,\r\n \"transitionDurat" +
Line 271: "ion\": 100,\r\n \"transformsEnabled\": true\r\n });\r\n\r\n " +
Line 272: " var msnry = $grid.data(\'masonry\');\r\n\r\n Ractive.decorators.mason" +
Line 273: "ryItem.parentNodes = msnry;\r\n });\r\n\r\n var ractive = new Ractive({\r" +
Line 274: "\n el: \"#message-output\",\r\n template: \'#message-template\',\r" +
Line 275: "\n decorators: {\r\n ads: adsDecorator\r\n },\r\n " +
Line 276: " append: true,\r\n oninit: function () {\r\n thi" +
Line 277: "s.set({\r\n eof: false,\r\n loading: false,\r\n " +
Line 278: " nextPage: \'");
Line 279:
Line 280:
Line 281: #line 121 "roo"
Line 282: Write(this.ViewBag.jsonNextPage);
Line 283:
Line 284:
Line 285: #line default
Line 286: #line hidden
Line 287: WriteLiteral("\',\r\n contents: [],\r\n adCount: 19\r\n " +
Line 288: " });\r\n\r\n $(\"#next-page\").hide();\r\n $(\'img.co" +
Line 289: "ntent\').unveil(300, function () {\r\n $grid.imagesLoaded(functi" +
Line 290: "on () {\r\n $grid.masonry(\'layout\');\r\n }" +
Line 291: ");\r\n });\r\n }\r\n });\r\n\r\n $(window).bind(\'s" +
Line 292: "croll\', function () {\r\n if ($(window).scrollTop() + 350 >= $(document" +
Line 293: ").height() - $(window).height() && ractive.get(\"loading\") == false) {\r\n " +
Line 294: " if (ractive.get(\"eof\") == true) {\r\n return;\r\n " +
Line 295: " }\r\n\r\n var nextPage = ractive.get(\"nextPage\");\r\n\r\n " +
Line 296: " ractive.set({ loading: true });\r\n $(\"#loading-content\").sh" +
Line 297: "ow();\r\n\r\n $.getJSON(nextPage, function (data) {\r\n " +
Line 298: " ractive.set({ nextPage: data.nextPage });\r\n data.contents" +
Line 299: ".forEach(function (i) {\r\n ractive.push(\"contents\", i);\r\n " +
Line 300: " });\r\n ractive.set({ loading: false });\r\n\r\n" +
Line 301: " $(\"#loading-content\").hide();\r\n\r\n $(\'img." +
Line 302: "content\').unveil(300, function () {\r\n $grid.imagesLoaded(" +
Line 303: "function () {\r\n $grid.masonry(\'layout\');\r\n " +
Line 304: " });\r\n });\r\n\r\n }).fail(function ()" +
Line 305: " {\r\n ractive.set({ eof: true });\r\n $(\"#loa" +
Line 306: "ding-content\").hide();\r\n ractive.set({ loading: false });\r\n\r\n" +
Line 307: " $grid.imagesLoaded(function () {\r\n $g" +
Line 308: "rid.masonry(\'layout\');\r\n });\r\n });\r\n " +
Line 309: " }\r\n });\r\n\r\n $(\".scroll-to-top\").click(function () {\r\n " +
Line 310: " $(\"html,body\").animate({ scrollTop: 0 }, 500);\r\n })\r\n\r\n });\r\n</script" +
Line 311: ">\r\n");
Line 312:
Line 313: }
Line 314: }
Line 315: }
Line 316: