ASP.NET MVC: Call one controller action from another, with ActionFilters applied -


take @ code below.

when get() calls foobar() , foobaz(), actionfilters decorate foobar() , foobaz() not invoked.

how can call these other 2 controller actions within get() in way causes someaction , anotheraction filters execute?

public class features : controller {     [someaction]     public bool foobar(string id = null)     {         return true;     }      [anotheraction]     public bool foobaz()     {         return false;     }      public jsonresult get()     {         return this.jsonresult(new dictionary<string, bool>()          {             { "foobar", this.foobar() },             { "foobaz", this.foobaz() }         });     } } 

controller actions aren't meant used methods. in order them function must called within request cycle. perhaps example simplistic, looks you're trying use these "actions" standard methods. while controller can technically have method that's never meant exposed route, it's not idea sort of thing. move logic off model or helper class.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -