I'm trying to create a 15 minute timer that when a user clicks a button to "Check out" or lock a case, it starts a timer that in 15 minutes runs an action to flip a boolean switch in my database that will unlock that case again after the 15 minutes. I'm assuming this needs to be done on my server side code and not in Javascript due to if a person leaves the page that script wouldn't run. I was hoping I could insert something in my action Method that could do this. I've researched, but can't find a definitive answer on how to go about this. Any help would be much appreciated.
using (Html.BeginForm("CheckoutCase", "Case"))
{
@Html.HiddenFor(x => x.ID)
<input type="submit" value="Checkout" name="submitAction" class="btn btn-block alert-success"/>
}
Controller
[HttpPost]
public ActionResult CheckoutCase(int id)
{
Case currentCase = db.Cases.Find(id);
currentCase.LockCase = true;
currentCase.Lockout_TS = DateTime.Now;
db.SaveChanges();
string url = this.Request.UrlReferrer.AbsolutePath;
return Redirect(url);
}