<p>In handling a form post I have something like</p>

<pre><code>    public ActionResult Insert()
    {
        Order order = new Order();
        BindingHelperExtensions.UpdateFrom(order, this.Request.Form);

        this.orderService.Save(order);

        return this.RedirectToAction("Details", new { id = order.ID });
    }
</code></pre>

<p>I am not using explicit parameters in the method as I anticipate having to adapt to variable number of fields etc. and a method with 20+ parameters is not appealing.</p>

<p>I suppose my only option here is mock up the whole HttpRequest, equivalent to what Rob Conery has done. Is this a best practice? Hard to tell with a framework which is so new.</p>

<p>I've also seen solutions involving using an ActionFilter so that you can transform the above method signature to something like</p>

<pre><code>[SomeFilter]
public Insert(Contact contact)
</code></pre>

[{'answer_id': 28799, 'author': 'Matt Hinze', 'author_id': 2676, 'author_profile': 'https://Stackoverflow.com/users/2676', 'pm_score': 0, 'selected': False, 'text': '<p>Wrap it in an interface and mock it.</p>\n'}, {'answer_id': 29087, 'author': 'liammclennan', 'author_id': 2785, 'author_profile': 'https://Stackoverflow.com/users/2785', 'pm_score': 0, 'selected': False, 'text': '<p>Use NameValueDeserializer from <a href="http://www.codeplex.com/MVCContrib" rel="nofollow noreferrer">http://www.codeplex.com/MVCContrib</a> instead of UpdateFrom.</p>\n'}, {'answer_id': 35299, 'author': 'Joseph Kingry', 'author_id': 3046, 'author_profile': 'https://Stackoverflow.com/users/3046', 'pm_score': 2, 'selected': True, 'text': '<p>I\'m now using <a href="https://stackoverflow.com/questions/34709/how-do-you-use-the-new-modelbinder-classes-in-aspnet-mvc-preview-5#34725">ModelBinder</a> so that my action method can look (basically) like:</p>\n\n<pre><code>    public ActionResult Insert(Contact contact)\n    {\n\n        if (this.ViewData.ModelState.IsValid)\n        {\n            this.contactService.SaveContact(contact);\n\n            return this.RedirectToAction("Details", new { id = contact.ID });\n        }\n        else\n        {\n            return this.RedirectToAction("Create");\n        }\n    }\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/28723', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3046/']