I am writing ASP.NET MVC3 application and ran into one problem. The application is a message board. Ads can be of two types: free (Priority 2) and paid (priority 1) for a period of 2 weeks. If a user publishes a paid ads, it has the highest priority and is always at the top of the message board. The problem is this: it is necessary that in 2 weeks all paid ads automatically become free, that is, their priority is changed from 1 to 2. Please tell me how to deal with this problem? I guess I need to write a procedure that will automatically run 1 time a day (at 00:00:01) and check the validity of all paid ads, and in case of excess of two weeks (14 days), to automatically change their status from 1 to 2. If so, tell me how to automatically call a procedure - through SQL (stored procedure) or directly from the controller?
This is my model file:
public class Ad
{
public int AdId { get; set; }
...
public int AdPriority { get; set; }
}
AdPriority can be only 1 or 2 ...
Thanks in advance for your help!