Get/Post Controller Logic Best Practice

Posted by Brian Mains on Programmers See other posts from Programmers or by Brian Mains
Published on 2012-12-09T02:46:26Z Indexed on 2012/12/09 5:18 UTC
Read the original article Hit count: 195

Filed under:
|

In an ASP.NET MVC project (Razor), I have a Get request, which loads two properties on a model, dependent on the property passed into the action method. So if the parameter has a value, the Group property is supplied data. But if not, the Groups collection property is supplied data.

In the post action method, when I process the data, to repopulate the view, I have to provide similar logic, and could getaway with returning Action(param) (the get response) to the caller.

My question is, based on experience, is that a good practice to get into? I see some downsides to doing that, but adds the lack of code redundancy. Or is there a better alternative?

© Programmers or respective owner

Related posts about asp.net-mvc

Related posts about Razor