Possible Duplicate:
ASP.NET MVC – Can i have multiple names for the same action?
I was wondering if its possible to have two actions point to the same ActionResult in a controller, like so:
[HttpPost]
[ActionName("ManualSearch")]
[ActionName("AddProduct")]
public virtual ActionResult MyPostAction(MyModel model)
{
// do code...
}
The reason for doing this is because I have 2 views that each process an action differently but they both contain a form, which essentially is doing the same thing, so I was wondering to just make those 2 forms POST to the same action, like I tried above, only apparently its not possible to duplicate the ActionName attribute.
Why not to create two different actions and a private method called by the two?
I think easiest things are the most reliable 😉