title: How to deal with complex queries in ASP.NET MVC 3?
body: <p>Although the problem I'll be detailing in this question is quite specific, I guess it should help some other beginner programmers like me. I have this following situation: in the system I'm designing, the user has the option to set the values for his search in the database (instead of just routing the parameter of the controller action to the id of a object in the database, as I've done before), with the following fields:</p>
  
  <ul>
  <li>Power Plant (Drop down list of all of the existing Power Plants)</li>
  <li>Generating Units (List box with multiple selection that displays the generating units of the selected Power Plant)</li>
  <li>Period (A drop down list with the available time spans, like "Last 7 days" and "Last Month")</li>
  <li>Beginning and End Time (If instead of selecting a predefined time, the user wants to define the specific time span)</li>
  </ul>
  
  <p>How can I put this elements on a page and search for the specified values in the database? I mean, how do I make this fields an object that I can send to the POST action, so it can compare to the database and get the values? What I've tried to do included create an editor template for this (but I couldn't understand what I was doing), and also I tried creating a controller to deal with this queries, so I could render just the query in the other pages (but I ended up with a page inside a page, in the best of "yo dawg I haerd u liek" style).</p>
  
  <p>Can you guys give me some help, so I don't have to give up being a programmer and become a rapper?</p>