AFAIK there is no standard way to declare / program tasks in an MVC project. The recommended way to accomplish what you want is to create a new Console Application project in your solution and use the Windows task scheduler to execute every X minutes, releasing any products that were more than X minutes in any cart.
To do this, you will need to refer to your MVC project from a new one (in order to access all models) or, even better, create a class library project, move the model / database classes there and link it from MVC projects and the console.
All that is said is actually a small βhackβ that can be used to get programmed tasks in an MVC project. You can use the following code:
HttpContext.Current.Cache.Add("Task", "1", null, DateTime.MaxValue, TimeSpan.FromMinutes(5), CacheItemPriority.Normal, new CacheItemRemovedCallback(CheckCarts));
This line, which can be called, for example, from Global.asax, will add the entry "Task" to the cache. The stored value ("1") does not matter, it is important that the cache entry expires in five minutes and, when expired, calls the "CheckCarts" method (defined in Global.asax or in the class that you are executing this code).
public void CheckCarts(string key, object value, CacheItemRemovedReason reason) {
When the cache expires, the CheckCarts method is called, your code does everything it needs to do, and at the end adds itself to the cache again to be called after another 5 minutes.