I have a controller method with a custom FilterAttribute on it...

[ActivityHistory]
public ActionResult Index(Vehicle vehicle, string componentName)
{
    return PartialView("_Description");
}

The Activityhistory class...

public class ActivityHistoryAttribute : FilterAttribute, IResultFilter
{
    public void OnResultExecuting(ResultExecutingContext filterContext)
    {
      //I would like to use the Vehicle object passed into the controller here
      //The cotroller call is made from jQuery and json, the ASP.NET MVC modelbinding
      // is creating the c# object instance.  Can I resuse this object within this method? 
    }
 }

That's pretty much my question, can I reuse the modelbound Vehicle object in my custom attribute class? How do I pass a reference to that object to the custom attribute class.

Thanks for any tips or ideas on how I can accomplish this, if its even possible.

Cheers, ~ck in San Diego

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top