title: Display Model Data in View
body: <p>I am new to ASP.NET MVC and I am having trouble updating the model data and then displaying it my view.</p>
  
  <p>I currently have a MortgageCalculator class that I am using as a model.</p>
  
  <pre><code>    public double loan_amount { get; set; }
      public double interest { get; set; }
      public int loan_duration { get; set; }
      public int payments_year { get; set; }
  </code></pre>
  
  <p>Code for the controller is:</p>
  
  <pre><code>    [httpGet]
      public ActionResult M_Calculator()
      {
          var mortgageCalculator = new MortgageCalculator();
          return View(mortgageCalculator);
      }
      [HttpPost]
      public ActionResult M_Calculator(MortgageCalculator mortgageCalculator)
      {    
          UpdateModel(mortgageCalculator);
          return RedirectToAction("Results");
      }
  
      public ActionResult Results (MortgageCalculator mortgageCalculator) 
      {
          return View(mortgageCalculator);
      }
  </code></pre>
  
  <p>Code for my view is:</p>
  
  <pre><code>@using (Html.BeginForm())
  {
  &lt;fieldset&gt;
      &lt;legend&gt;Mortgage Calculator&lt;/legend&gt;
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.loan_amount)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.TextBoxFor(model =&gt; model.loan_amount)
      &lt;/div&gt;
      &lt;br /&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.interest)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.TextBoxFor(model =&gt; model.interest)
      &lt;/div&gt;
      &lt;br /&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.loan_duration)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.TextBoxFor(model =&gt; model.loan_duration)
      &lt;/div&gt;
      &lt;br /&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.payments_year)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.TextBoxFor(model =&gt; model.payments_year)
      &lt;/div&gt;
      &lt;br /&gt;
  
      &lt;input type="submit" value="Calculate" /&gt;
  
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>}</p>
  
  <p>I want to make some calculations on the data that I receive from the user and then show the results in my Results view. I don't have any database. I just want to perform simple calculations on data and show the results. The solution seems to be pretty straight forward but I am stuck. I would appreciate any help.</p>