title: LINQ expression inside foreach loop
body: <p>In my View() i have many checkboxes with attr name="types". In my ActionResult I have a List types like parameter, and I do foreach loop to search in List, each type ID and add a Where() filter in my LINQ expression. If I select many types, the return is only one result and dont all what i chose. Look:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Index(List&lt;int&gt; types) {
    var variable = from s in MyViewModel select s;
  
    foreach(var type in types) {
      variable = variable.Where(x =&gt; x.TypesId == type);
    }
  
    return View(MyViewModel);
  }
  </code></pre>
  
  <p>Is there another way to do this?</p>
  
  <p>Thank you!!</p>