title: Using multiple checkboxes for same property to filter data in MVC .NET
body: <p>I am following the ASP.NET MVC 5 tutorial at <a href="http://www.asp.net/mvc/overview/getting-started/introduction/getting-started" rel="nofollow">http://www.asp.net/mvc/overview/getting-started/introduction/getting-started</a></p>
  
  <p>This tutorial creates a basic database containing movie objects, of which the properties are title, release date, genre, and price.</p>
  
  <p>I have two checkboxes, one for movies who's price is 5, and one for 10.  </p>
  
  <p>What I have works fine if only one of the checkboxes is selected, but if both are selected (I am trying to list movies who's price is 5 and movies who's price is 10) then nothing is shown in the view.</p>
  
  <p>Am I way off?</p>
  
  <p>Model:</p>
  
  <pre><code> public class Movie
   {
      public int ID { get; set; }
      public string Title { get; set; }
      public DateTime ReleaseDate { get; set; }
      public string Genre { get; set; }
      public decimal Price { get; set; }
  
   }
  
  public class MovieDBContext : DbContext
  {
      public DbSet&lt;Movie&gt; Movies { get; set; }
  }
  </code></pre>
  
  <p>Controller:  </p>
  
  <pre><code> public class MoviesController : Controller
  {
      private MovieDBContext db = new MovieDBContext();
  
  
  
      public ActionResult Index(bool movieCost5 = false, bool movieCost10 = false)
      {
  
          var movies = from m in db.Movies
                       select m;
  
  
  
          if (movieCost5 == true &amp;&amp; movieCost10 == false)
          {
              movies = movies.Where(x =&gt; x.Price == 5);
          }
          else if (movieCost5 == true &amp;&amp; movieCost10 == true)
          {
              movies = movies.Where(x =&gt; x.Price == 5 &amp;&amp; x.Price == 10);
          }
  
          else if (movieCost5 == false &amp;&amp; movieCost10 == true)
          {
              movies = movies.Where(x =&gt; x.Price == 10);
          }
  
          return View(movies);
      }
  }
  </code></pre>