views:

189

answers:

2

Can a so called action in my controller just be a regular function that returns anything I want or does the return of an ActionResult declare whether its an "action" or not?

I was wondering if i could call functions in my ActionLink in the "actionname" that didn't return actionresults.

thx

+4  A: 

All public methods of a controller are actions by default, regardless of return type. So, yes, you can call them. Use [NonActionAttribute] to override this default.

Craig Stuntz
Yeah my question probably didn't make sense all that much, but this is what i wanted to know. thanks
Dacrocky
A: 

Yes, all actions should return an ActionResult. The MVC engine only know to handle an ActionResult (or a derivative).

I don't understand what you mean with "call functions in my ActionLink that don't return ActionResults". Even if you don't want to return any meaning, you still have to return an ActionResult.

What is it you want to accomplish?

Inferis
Should, I agree. Must, that's not true. Try it!
Craig Stuntz