title: Getting data from a .cs file to a .cshtml
body: <p>I'm trying to pass the data received from my function to a .cshtml file that uses javascript.</p>
  <pre><code>public static int LastID()
          {
              int LastArticleNr;
              SqlConnection conn = GetSqlConnection(null);
  
              conn.Open();
              LastArticleNr = conn.QueryFirstOrDefault &lt;int&gt; (&quot;SELECT CAST(isnull(last_value,0) AS INT) AS ID FROM sys.identity_columns WHERE object_id = OBJECT_ID('Artikel')&quot;);
              conn.Close();
  
              return LastArticleNr;
          }
  </code></pre>
  <p>Now I don't know whether this is possible or not, or whether I would need to use a different method of getting this data. However what I've tried is simply calling the function which, to probably no-ones surprise didn't do much. I've also tried this:</p>
  <pre><code>@using namespace.Classes.DataLayer;
  @{
  var LastID = DataLayer.LastID();
  }
  </code></pre>
  <p>However even if the using clause <em>should</em> include the class in which this function exists, it fails to recognise the DataLayer class.</p>