title: I want to sum together values in ASP.NET MVC and display them in razor
body: <p>I have several costs/fees to display for a tenant and now I want to sum up all the values. Here is my code.</p>
  
  <pre><code>@foreach (var item in Model.Contracts)
              {
                  &lt;tr&gt;
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; item.Apartment.MonthParkfee)
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; item.Apartment.MonthUtilityFee)
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; item.MonthlyRent)
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.DisplayFor(sumOfAllFees =&gt; MonthParkFee + MonthUtilityFee + MonthlyRent)
                      &lt;/td&gt;
                  &lt;/tr&gt;
              }
  </code></pre>
  
  <p>The MonthParkFee and MonthUtilityFee are both in the Apartment table while the MonthlyRent is in the contract table but the contract table contains the foreign key for the Apartment table. How would I be able to add those values together in razor and render them?</p>