accessing c# code in razor view @{<text> block
<p>I apologize if my terminology is not correct.  I just got on a project that uses Javascript and asp.net.  I'm not really familiar with both and am trying to implement some simple features or fix bugs.  Currently the razor view looks like:</p>

<pre><code>@{
    string rootUrl = Url.Action(MVC.Files.Files(Model.Id, null));
    Html.Telerik().ScriptRegistrar().Scripts(wa =&gt; wa.AddSharedGroup(@Url.AssetName(AssetGroups.FileBrowser))
                                                     .AddSharedGroup(@Url.AssetName(AssetGroups.SinglePageApps)))
    .OnDocumentReady(
    @&lt;text&gt;
        window.fileBrowser = fileBrowser('ls', 'file_breadcrumb', '@Model.Path', '@rootUrl');

         var runLink = "@Url.Action(MVC.Runs.Run(Model.Id, Model.ExperimentName.ToLegalUrl()))";

         // checking for the model
         if (@((Model.HasSettings.ToString().ToValue()) == true)) {
console.log("true");
         }
         else {
console.log("false");
}

         window.leftNav = new NavView({
            el: "#navview",
            collection: new NavItems(),
            items: [
</code></pre>

<p>My model for the page, has a property HasSettings.  Based on HasSettings, I want to populate the <code>items</code> array at the bottom fo the code with certain items.  I can't figure out the syntax for this.  </p>

<p>I originally started with </p>

<p><code>if ('@Model.HasSettings') {</code></p>

<p>and have been trying different forms, but I'm really not sure what the syntax is to check it so I can populate my items array.  I know if I look at Model.HasSettings outside of this @ block, it evaluates to True or False.  And then in the console when I run the page, it says True or False is undefined.  </p>

<p>My first question is what is the correct syntax?</p>

<p>My second question is, should I just copy and paste the entire block </p>

<pre><code>window.leftNav = new NavView({
            el: "#navview",
            collection: new NavItems(),
            items: [
</code></pre>

<p>into each if/else statement with only the items array being different.  Or is there a cleaner way to do that?  Thanks in advance!</p>
