Action method in MVC

                                Action Method in MVC



         1)  When we create a controller in MVC it creates Default method Index which is called as 
               Action method
  
         2)  When you create a method in controller every method is public. means every action method
               is public 

         3)  When we create an Action method we can not create a method as static.
  
         4)  When we hit URL from the browser then it performs the MVC life cycle and finds a
               controller and action method in return response to the user.

          Let Understand How to create Action method in Controller 
        

          


     The first step to creating a project  in MVC  . after creating a project  right click on the controller 
      Add Controller and inside a controller, we can add multiple action method.

     

   

    please choose controller and give controller name so when we create controller it creates
    default method which is index method 

   


 
         as per image, we have created the Learn controller and create an Index method.  we can
         create multiple methods inside the controller. 

         using an action method we can return the model to view. 

         Read  below links to understand ActionResult type 
          
          https://mvc-learn.blogspot.com/2020/08/actionresult-return-type-in-mvc.html
      
 
       

Comments

Popular posts from this blog

How To Create an MVC application in Visual Studio 2019

ActionResult Return Type in MVC

Explain terms of MVC ?