title: How to simulate an online reservation in ASP.NET MVC?
body: <p>I have in my database something like this:</p>
  
  <pre><code>public partial class Reservation
  {
      public int ReservationID { get; set; }
      public System.DateTime Data { get; set;}// this has the date and the hour
      public string User_Id { get; set; }
      public string Service { get; set; }
  }
  </code></pre>
  
  <p>In order to make a new reservation, the client has to introduce the date, the service and the hour. I want to make a <code>ComboBox</code> with the hours which are available for the date, that was already selected. I was thinking of making something like this: a list with all hours in general, to query the database and select the hours which have already been reserved. Then to subtract from all the hours, the ones which have been reserved and the result will be in that <code>ComboBox</code>. What I've done until now is an <code>IEnumerable SelectListItem</code> with all hours from 10 am to 6 pm and a query which gives me the reserved hours, but I don't know if it works. I assumed that "date" is a parameter selected previously. </p>
  
  <pre><code>IEnumerable&lt;SelectListItem&gt; occupied = db.Reservation.Where(x =&gt; x.Data == date).Select(
      m =&gt; new SelectListItem
      {
          Value = m.Data.ToShortTimeString(),
          Text = m.Data.ToShortTimeString()
      }
  );
  </code></pre>
  
  <p>If this is correct, what should I do next ? If not, please suggest an alternative method.</p>