Reputation: 318
Need advice on below scenario.
I have two links on my page
1.) Read only Mode
2.) Normal Mode
Both the link will displays same view, but for link one my view will be rendered in read-only mode.
Question
I have two ways to do this.
1. Create two different actions in my controller.
1.) Read only Mode--- My link will be---- Controller/IndexRO
2.) Normal Mode----- Controller/Index --- ("Index and IndexRO")
2. Pass a query string parameter
1.) Read only Mode--- My link will be---- Controller/Index?mode=ReadOnly
2.) Normal Mode----- Controller/Index?mode=Normal
I want to understand pros and cons of both the ways. Just want to understand which one will be easier going further and which can create problems.
Its an MVC4 asp.net 4.0 web application.
Upvotes: 1
Views: 97
Reputation: 19
I would definitely go with the second way. You generally do not want to create the same object twice. It's not professional and lowers the readability of your code. Passing a parameter through url would be better
Upvotes: 1