title: Call and temporarily store and object within an MVC View
body: <p>I am still in the process of learning the ASP.NET MVC3 Razor engine, and I'm trying to wrap my head around how to accomplish something that seems so <strong>incredibly simple</strong>.</p>
  
  <p>I have a static class that encapsulates a method which calls a third party API.  My <code>_Layout.cshtml</code> <em>master page</em> calls the static class, e.g.</p>
  
  <pre><code>if(@Rf.Models.PageContent.GetSomething().IsSomethingHappening) {
     &lt;span&gt;@Rf.Models.PageContent.GetSomething().Name&lt;/span&gt;
  }
  </code></pre>
  
  <p>As you can see I am duplicating effort (and a call to the third party API) from my static class PageContent, method GetSomething -- which returns a class.</p>
  
  <p>In regular old MVC2, I would have done something like this:</p>
  
  <pre><code>&lt;% var obj = Rf.Models.PageContent.GetSomething();
     if(obj.IsSomethingHappening) { %&gt;
     &lt;span&gt;&lt;%=obj.Name%&gt;&lt;/span&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p>...which doesn't duplicate effort.</p>
  
  <p>I want to call PageContent.GetSomething() once, store it, and reference it if my flag is true.  I do not want to call PageContent.GetSomething() again, if my flag is true.</p>
  
  <p>This may be a very simple question, but I'm a bit stuck on how to accomplish it.  How can I duplicate the same kind of functionality from within the Razor engine?</p>