title: Mvc Layout page dynamic content
body: <p>I have an MVC layout page(master page) with some dynamic content in the header and footer.</p>
  
  <pre><code>       &lt;header&gt;
  
          @Html.Action("GetHeader", "Layout")
  
      &lt;/header&gt;
  
     &lt;div id="body"&gt;
  
             @RenderBody()
  
      &lt;/div&gt;
  
      &lt;footer&gt;
          @Html.Action("GetFooter", "Layout")
      &lt;/footer&gt;
  </code></pre>
  
  <p>GetHeader and GetFooter action methods get values from database into an object and return partial view based on the header/footer properties of that object.</p>
  
  <p>But the thing is I do not want to make two calls to the database,because they both use the same object type.</p>
  
  <p>so is there any way so that I can call database just once and retain that object and use it through out the layout page,without calling the database multiple times?</p>
  
  <p>any solution other than using viewbag will be very helpful.</p>
  
  <p>Thanks! </p>