Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which layer is the best to add a new method?
Message
 
 
À
10/07/2015 03:48:21
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01619738
Message ID:
01621954
Vues:
49
>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform