title: Accessing the value of query returning list in controller
body: <p>Here is my schedule class</p>
  
  <pre><code>[Table("Schedules", Schema = "Expedia")]
  public  class Schedule
      {
  
          [Key]
          [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
          public int ScheduleId { get; set; }
  
          [ForeignKey("Inventory")]
          public int FlightId { get; set; }
          public FlightInventory Inventory { get; set; }
  
          [Display(Name = "Departure city")]
          public string DepartureCity { get; set; }
  
          [Display(Name = "Arrival city")]
          public string DestiationCity { get; set; }
  
          [Display(Name = "Departure date")]
          [Required]
          public string DepartureDate { get; set; }
  
          [Required]
          [Display(Name = "Arrival date")]
          public string ArrivalDate { get; set; }
  
          [Required]
          [Display(Name = "Departure Time")]
          public string Departure { get; set; }
  
          [Required]
          [Display(Name = "Arrival Time")]
          public string Arrival { get; set; }
  
          [Display(Name = "Price/Ticket")]
          public int Price { get; set; }
      }
  }
  </code></pre>
  
  <p>here is my context class</p>
  
  <pre><code> public class UsersContext : DbContext
   {
       public UsersContext() 
           : base("Expedia") { }
  
       public DbSet&lt;Schedule&gt; schedules { get; set; }
   }
  </code></pre>
  
  <p>Here is My Function Returning the query result:</p>
  
  <pre><code> public dynamic Details(int ScheduleID)
   {
       var query =(from f in db.schedules.Where(f =&gt; f.ScheduleId== ScheduleID)
                   select new
                   {
                       f.ScheduleId,
                       f.DepartureDate,
                       f.ArrivalDate,
                       f.Departure,
                       f.Arrival,
                       f.DepartureCity,
                       f.DestiationCity,
                       f.Inventory.provider,
                       f.Inventory.nonstop,
                       f.Price,
                       f.Inventory.Available
                   }).ToList();
  
       return query.AsEnumerable();
   }
  </code></pre>
  
  <p>When I call this in my controller: </p>
  
  <pre><code>var result= x.Details(selectedID);
  </code></pre>
  
  <p>the result variable shows <code>null</code> value although the query is returning a value.</p>
  
  <p>How to access the query result in the controller?</p>
  
  <p>Please provide any link, reference, hint.</p>