title: How to add two models in one view ASP.NET MVC
body: <p>I have two models. The 1st model contains every record in the database. The 2nd model contains the highest amount in the records. </p>
  
  <p>How can I get two models in one view? I am new to Asp.NET MVC and just trying to get the hang of it.</p>
  
  <p>Here is the code.</p>
  
  <p><strong>Model</strong></p>
  
  <pre><code>namespace CharitySite.Models
  {
  
      public class Charity
      {
          public int ID { get; set; }
          public string DisplayName { get; set; }
          public DateTime Date { get; set; }
          public Double Amount { get; set; }
          public Double TaxBonus { get; set; }
          public String Comment { get; set; }
      }
  
      public class CharityDBContext : DbContext //controls information in database 
      {
          public Charity Highest { set; get; }
          public DbSet&lt;Charity&gt; Donations { get; set; } //creates a donation database
          public CharityDBContext()
          {
              this.Highest = new Charity();
  
  
          }
      }
  
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>namespace CharitySite.Controllers
  {
      public class CharitiesController : Controller
      {
          private CharityDBContext db = new CharityDBContext();
  
          // GET: Charities
          public ActionResult Index()
          {
              var AllDonations = new CharityDBContext();
              var all = db.Donations.OrderByDescending(s =&gt; s.Amount);
              if (all.Any())
              {
                  //Get the highest amount record
                  var h = all.First();
                  AllDonations.Highest.DisplayName = h.DisplayName;
                  AllDonations.Highest.Amount = h.Amount;
                  AllDonations.Highest.Comment = h.Comment;
              }
  
              return View(AllDonations);
          }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>@model IEnumerable&lt;CharitySite.Models.Charity&gt;
  @model CharitySite.Models.CharityDBContext
  
  
  
  @{
      ViewBag.Title = "Index";
  
  }
  
  &lt;link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="@Url.Content("~/Content/bootstrap.css")" rel="stylesheet" type="text/css" /&gt;
  &lt;div id="header"&gt;
  
      &lt;h1&gt;Syria&lt;/h1&gt;
  
  &lt;/div&gt;
  
  &lt;h2&gt;Highest&lt;/h2&gt;
  &lt;p&gt;@Model.Highest.Amount&lt;/p&gt;
  &lt;p&gt;@Model.Highest.DisplayName&lt;/p&gt;
  
  &lt;h2&gt;Highest&lt;/h2&gt;
  &lt;p&gt;@Model.Highest.Amount&lt;/p&gt;
  &lt;p&gt;@Model.Highest.DisplayName&lt;/p&gt;
  
  &lt;h2&gt;Highest&lt;/h2&gt;
  &lt;p&gt;@Model.Highest.Amount&lt;/p&gt;
  &lt;p&gt;@Model.Highest.DisplayName&lt;/p&gt;
  
  &lt;div class="table-title"&gt;
      @Html.Partial("_Database", Model);
  
  &lt;/div&gt;
  </code></pre>