This website includes Education Information like a programming language, job interview question, general knowledge.mathematics

Education log

PageNavi Results No.

Ads

Saturday, December 2, 2023

what is action method in mvc with example

 what is action method in mvc with example


In ASP.NET MVC, an action method is a public method in the MVC Controller that handles user requests and generates a response. The response is usually an ActionResult. 

What is the Action Method in MVC 5. ASP.NET MVC action methods are responsible to execute the request and generate a response to it. All the public methods of the MVC Controller are action methods. If we want the public method to be a non-action method, then we can decorate the action method by “NonAction” attribute



What is the action of method?

The Action Method was designed to help push projects forward by organizing ideas, with a focus on action steps. The distinct zones on each page provide a flexible template to get the most out of meetings and everyday brainstorm sessions. Action Method products come in many sizes, colors, and designs.


Example of action method in mvc:

public class HomeController : Controller  

{  

    public ActionResult SayHello()  

    {  

        ViewData["SayHello"] = "Hello";  

        return View();  

    }  

    public string SayHi()  

    {  

        return "hi from 'SayHi'.";  

    }  

  

}  

No comments:

Post a Comment