title: Asp.net Core EF Core Inner Join, and data to View Model
body: <pre><code>public async Task&lt;IActionResult&gt; Index()
  {
      AppointmentsViewModel appointmentsViewModel = new AppointmentsViewModel();
  
        var ap = await (from p in _context.Mstr_Patients
                join e in _context.Appointments on p.PatientID equals e.PatientID
                select new { No = e.AppointmentNo, Date = e.AppointmentDate, Name = p.FullName, Ref = e.RefDoctor }).ToListAsync();
  
  
  
      return View(ap);
  }
  </code></pre>
  
  <pre><code>public class AppointmentsViewModel
  {
      public int No { get; set; }
  
      public DateTime Date { get; set; }
  
      public string Name { get; set; }
      public string Ref { get; set; }
  }
  </code></pre>
  
  <p>How do I bind my data from the inner join to the ViewModel class, so I can display it on a view? </p>
  
  <p>I've tried <code>ap = appointmentsViewModel;</code>  but it gives me an error. How do I do that?</p>