ASP.NET MVC: post-redirect-get pattern, with two overloaded action methods

Is it possible to implement post-redirect-get pattern, with two overloaded action methods (One for GET action and the other for POST action) in

In all of the MVC post-redirect-get pattern samples, I have seen three different action methods for the post-redirect-get process (corresponding to Initial Get, Post, and the Redirection Get), each having different names. Is this really required to have minimum three action methods with different names, in

For Eg: (Does the code shown below, follows Post-Redirect-Get pattern?)

public class SomeController : Controller
    // GET: /SomeIndex/
    public ActionResult Index(int id)
        SomeIndexViewModel vm = new SomeIndexViewModel(id) { myid = id };
        //Do some processing here
        return View(vm);

    // POST: /SomeIndex/
    public ActionResult Index(SomeIndexViewModel vm)
        bool validationsuccess = false;
        if (validationsuccess)
            return RedirectToAction("Index", new {id=1234 });
            return View(vm);

Thank you for your responses.


Think from the unit-testing perspective.

If everything was in a single action, then code would be quite difficult to test and read. I see no problems in your code what so ever.

Your code seems fine to me. Follows the pattern and this is how we do it in all of our projects.

Need Your Help

How to implement public,private and protected keywords in c-language?


Somebody can give me an example to do this. Suppose static variable scope is limited to file only.That is private to that file.Like that some more examples i want to know. In other words HOW TO AC...

Parsing Json C#

c# json parsing deserialization

I have a big problem parsing JSON in C# in Windows Phone 8 app.