Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Which layer is the best to add a new method?
Message
 
 
General information
Forum:
ASP.NET
Category:
Class design
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01619738
Message ID:
01621954
Views:
50
>>UPDATE. Found this http://stackoverflow.com/questions/872796/asp-net-mvc-accessing-view-model-from-a-custom-action-filter which may be a way to go.
>
>I've only used the approach with WebAPI rather than the MVC model but they are substantially the same. Looks like that might work.

We're also using API Controller and the code from that link is not working.

Here is what I am trying and can not figure out how to get to the model:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using Glimpse.Core.Tab.Assist;

namespace SysManager.Web.Infrastructure.Filters.Api
{
    public class AuditActionFilter : ActionFilterAttribute
    {
        public override void OnActionExecuting(HttpActionContext filterContext)
        {

            var model = filterContext.ControllerContext.Controller; // ViewData.Model is not working here
            base.OnActionExecuting(filterContext);
        }       
    }
}
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform