Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
PROBLEM
can I use string function inside controller and replace action or not on asp.net mvc5 ?

on mvc when link to any webapplication i use default route
controller/action
can i use function return string as function ShowText() after controller
meaning controller/ShowText or must use ActionResult ?
and when route to link Employee/ShowText
are this route will work ?

What I have tried:

C#
controller
public string ShowText()
{
string show = "welcom ";
return show ;
}
Posted
Updated 10-Jul-19 10:08am

1 solution

Yes, you can actually use any method type within a controller class.
 
Share this answer
 
Comments
ahmed_sa 10-Jul-19 16:12pm    
and when routing can i replace action with this method showtext or not ?
MadMyche 10-Jul-19 16:33pm    
I would recommend you try it and find out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900