title: ASP.net MVC 5 ViewBag using Razor
body: <p>Hey all I'm new to MVC/Razor and I am wanting to simply display a year on the view page.</p>
  
  <p>The view page code:</p>
  
  <pre><code>&lt;p&gt;&amp;copy; @Html.Raw(ViewBag.theDate) - Switchboard&lt;/p&gt;
  </code></pre>
  
  <p>And my controller code:</p>
  
  <pre><code>public String getYear()
  {
      ViewBag.theDate = DateTime.Now.Year.ToString();
  
      return View(ViewBag.theDate);
  }
  </code></pre>
  
  <p>When viewing the page in IE it just prints out:</p>
  
  <blockquote>
    <p>© - Switchboard</p>
  </blockquote>
  
  <p>How can I call that controller function from my View using Razor?</p>