title: LINQ statement - WHERE clause for ENUM type
body: <p>I followed MSDN tutorial about filtering functionality in ASP.NET MVC web app > <a href="http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application" rel="nofollow">http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application</a></p>
  
  <p>Unfortunately, I can't select an object which has an enum attriubute.</p>
  
  <p>Used model is:</p>
  
  <pre><code>public Bus()
      {
      public int BusID { get; set; }
      public string RegNum { get; set; }
      public Status? Status { get; set; }
      public string Latitude { get; set; }
      public string Longitude { get; set; }
      }
  </code></pre>
  
  <p>where the enum type is:</p>
  
  <pre><code>public enum Status
  {
      ON, OFF
  }
  </code></pre>
  
  <p>According to the mentioned tutorial I implemented sorting method in BusController as shown below:</p>
  
  <pre><code>public ViewResult Index(string searchString)
      {
          var buses = from b in db.Buses select b;
          if (!String.IsNullOrEmpty(searchString))
          {
              buses = buses.Where(b =&gt;
                  b.RegNum.ToUpper().Contains(searchString.ToUpper())
                  );
          }
  
          return View(buses.ToList());
      }
  </code></pre>
  
  <p>it works fine for RegNum filtering, but I can't select the Bus for the given status by searchstring value.</p>
  
  <p>b.Status.Equals(searchstring) doesn't work.</p>
  
  <p>I'd be grateful for any hints</p>