title: MVC - Generic Actions
body: <p>I've got a page in an app I'm building. The page contains a few bits and pieces, then a partial view that loads a different view depending on what's selected from a dropdown. Each of the options from the dropdown has a different view associated with it, and each view has its own fields and model. </p>
  
  <p>Whatever the view is that loads, I'm performing the same action - I'm serializing the model and storing the XML in a database. This is always the case, and there is no unique processing based on the views/models (other than the fact that the fields are different). All models inherit from the same base class for serialization purposes.</p>
  
  <p>I wanted to be able to do something like:</p>
  
  <pre><code>public ActionResult SubmitPartialView&lt;T&gt;(T model)
  {
     BaseClass baseClassModel = (BaseClass)(object)model;
     // serialize and save to database
  }
  </code></pre>
  
  <p>But MVC doesn't allow this - "cannot call action on controller because the action is a generic method". </p>
  
  <p>If I try passing the BaseClass in as a parameter itself, it only contains the properties of the base class and therefore none of the model's properties.</p>
  
  <p>Is there no other option other than to create a separate action for every single view that can submit, and make each one call a separate method that handles the logic?</p>