title: How to return JSON in a ASP.NET MVC/web controller?
body: <p>My problem is that I've been following ASP.net MVC/API tutorials I have a working controller in the MVC side of things. For instance this works fine and returns my data in a view:</p>
  
  <pre><code>public class DestinationController : Controller
  {
      private ebstestEntities db = new ebstestEntities();
  
      // GET: Destination
      public async Task&lt;ActionResult&gt; Index()
      {
  
          return View(await db.CI_DEST_ALL_VARIABLES.ToListAsync());
      }
  </code></pre>
  
  <p>However when I take a look at the following example, which I had working on another project, I cant seem to work out how to change it to fit in with my project controller above.</p>
  
  <pre><code>// GET: Destination
  public async Task&lt;ActionResult&gt; IndexVM()
  {
      var model = new BeerIndexVM;
  
      using (var db = new AngularDemoContext())
      {
          model.Beers = db.Beers.ToList();
      }
      return Json(model, JsonRequestBehavior.AllowGet);
  }
  </code></pre>