title: ASP.NET MVC EntityFramework: how to use LINQ inside ActionResult controller method?
body: <pre><code>[HttpPost]
      public ActionResult RemoveCollaborationEntry(int collaborationEntryID = 0)
      {
          using (var collaborationEntriesContext = new CollaborationEntryContext())
          {
              collaborationEntriesContext.Collaborations.Remove(
                  collaborationEntriesContext.Collaborations.ElementAtOrDefault(collaborationEntryID));
  
              collaborationEntriesContext.SaveChanges();               
          }
  
          return RedirectToAction(nameof(Index));
      }
  </code></pre>
  
  <p>When this method gets invoked, the exception is torwn: </p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method
    'annaBevzenkoPortfolioMVC.AboutMe.CollaborationEntry
    ElementAtOrDefault[CollaborationEntry](System.Linq.IQueryable`1[annaBevzenkoPortfolioMVC.AboutMe.CollaborationEntry],
    Int32)' method, and this method cannot be translated into a store
    expression.</p>
  </blockquote>
  
  <p>I am pretty new to Entity.. can someone help me?</p>