title: Automatic countdown timer to adjust database record
body: <p>I have a small MVC website which is for a friends Hair Salon. On this page I have a div which is used to display a number which it takes from a database record. This number is the current number of people sitting in the queue waiting for a haircut.</p>
  
  <p>What I have currently is the ability to logon to an "admin" page and update this number using a form, from say "2" to "5", then change "5" to "6" dependant on how many people are sitting in this queue.</p>
  
  <p>This is a manual operation as it currently stands. Code is below:</p>
  
  <p>=============================</p>
  
  <h1>Controller</h1>
  
  <pre><code>[HttpPost]
          public ActionResult Update(Data data)
          {
              if (ModelState.IsValid)
              {
                  data.ID = 1; //EF need to know which row to update in the database. 
                  db.Entry(data).State = EntityState.Modified;
                  db.SaveChanges();
                  return RedirectToAction("Index", "Home");
              }
  
              return View(data);
          }
  </code></pre>
  
  <p>====================================</p>
  
  <h1>Model code</h1>
  
  <pre><code>{
      public class Data
      {
          public int ID { get; set; }
          public string Queue_Number { get; set; }
      }
  
      public class DataDBContext : DbContext
      {
          public DbSet&lt;Data&gt;Queue { get; set; }
      }
  }
  </code></pre>
  
  <p>What I would really like to happen is that once you have manually updated the Queue Number from the form on the "admin" page I'd like an automatic count down of 20 minutes (the rough time it takes for the haircut) and then have the Queue Number auto-adjust down by one till it gets to "0". </p>
  
  <p>e.g. We have 5 people in the queue, 20 minutes later it is auto adjusted to 4 people and the web page will auto update / refresh, then 2 more people walk in so we manually adjust it to 6 people in the queue and the timer starts again, each 20 min passes the queue is adjusted by -1 till it gets down to "0". Once it gets to "0" it stays there until we manually add more people to the queue.</p>
  
  <p>I'm afraid I have no idea how to even begin with such a request, or even if it is possible?</p>
  
  <p>I'd be really thankful for any help from the experts here that might be able to "babystep" it for me. Any information I've not provided I'll endeavour to add - I realise I'm not the best at explaining myself :-(</p>