title: ASP.NET Comparing data from Database
body: <p>I'm currently working on a project which needs to check for the day and time, then compare these with values in my database. 
  This needs to be done for an Live Chat, while we have opened.
  I'm new to ASP.Net and this is giving me an headache.</p>
  
  <p>I Have a table which contains these Rows:
  - weekday
  - starttime
  - endtime</p>
  
  <p>In my Controller for the Chat I have tried this so far</p>
  
  <pre><code>private Model1Container db = new Model1Container();
  
      public ActionResult Index(Openinghours openinghours)
      {
          ViewBag.Opening = db.OpeninghoursSatz.ToList();
  
          string CurrentDay = DateTime.Now.DayOfWeek.ToString();
          string CurrentTime = DateTime.Now.TimeOfDay.ToString();
  
          bool IsWeekDay= db.OpeninghoursSatz.Where(i =&gt; i.weekday == CurrentDay).Any();
          var Starttime = db.OpeninghoursSatz.Find(CurrentDay);
          Debug.Write("!!++" + Starttime);
  </code></pre>
  
  <p>My exact Problem is to compare the time with the two rows from my table.
  I thought about putting the values in a variable and then compare them, but there must be a cleaner way for this.</p>
  
  <p>I hope I was able to point out what my problem is, if not please ask.</p>
  
  <p>With regards,</p>
  
  <p>Nico</p>
  
  <p>EDIT:
  Maybe I should say that the database holds the hour it opens and the hour it closes (e.g. 9 and 17). I need to check if the current time is between these two.</p>