Situation: For a school project I have to build an accommodation website where users can register and make a reservation to a particular accommodation for only 24 hours (after that other users can make a reservation to that accommodation and than they would have an option to that accommodation for 24 hours). How would I trigger an event to delete the record out of the database? Also for doing a reservation you need to click on a link/button to do a POST to my controller.
Any ideas?
I would opt not to ever delete a reservation record, but rather give it an expiration field. If a user tries to use a reservation, check whether the expiration field has already expired.
If you must delete the reservation record, I would recommend a separate process. You could implement a windows service that wakes up periodically and searches for expired reservations to delete, or run a console program that does the same from Task Scheduler.