i have to implement like this :
A user will be able to edit a comment till 10 minutes after posting the comment. There will be an edit link associated with the comment of the server time is less than 10 minutes of the posted comment. However, it may happen that the comment will not save if more than 10 minutes have passed.
how can i achieve this in asp.net mvc 3 ?
Yep, @Palantir is correct.
Just wanted to expand a little on how to tackle the presentation layer.
When saving comment, set a
CreatedOnfield toDateTime.Now.Have a ViewModel like this:
In your main View, use an Editor Template to render out the link:
Then the template:
This way your main view stays clean and DRY – since you can reuse this template across your application.