I have a small MVC website that is designed for hairdressing friends. On this page, I have a div that is used to display the number that is required to write the database. This number represents the current number of people who are waiting in line waiting for a haircut.
Currently, I have the opportunity to log in to the admin page and update this number using the form from "2" to "5", and then change "5" to "6" depending on the number of people sitting in this queue.
This is handmade, as it stands now. Code below:
===============================
Controller
[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); }
======================================
Model code
{ public class Data { public int ID { get; set; } public string Queue_Number { get; set; } } public class DataDBContext : DbContext { public DbSet<Data>Queue { get; set; } } }
I would very much like that after you manually updated the queue number from the form on the "admin" page, I would like the automatic countdown to be 20 minutes (rough time required for cutting) and then the queue number is automatically set to one until it reaches "0".
eg. We have 5 people in the queue, after 20 minutes it is automatically configured for 4 people, and the web page will be automatically updated / updated, and then 2 more people go, so we manually configure it for 6 people in the queue, and the timer starts again, every 20 minutes the queue is set to -1 until it drops to "0". Once it reaches "0", it stays there until we manually add more people to the queue.
I'm afraid I have no idea how to start with such a request, or even if it is possible?
I would be very grateful for any help from experts who could "get" it for me. Any information that I did not provide, I will try to add - I understand that I am not the best, explaining myself: - (