Tuesday, January 10, 2017

MVC Basics


In Asp.Net MVC request flow in general moves as follows:-
Step 1:- The first hit comes to the controller.
Step 2:- Depending on the action controller creates the object of the model. Model in turn calls the data access layer which fetches data in the model.
Step 3:- This data filled model is then passed to the view for display purpose.




Controller:

Logic which will handle the user requests and user’s interaction with server. In short User Interaction Logic


What is Action Method?

Action method is simply a public method inside controller which accepts user’s request and returns some response


Views :
user interface design is termed as UI layer and in Asp.Net MVC it is termed as View.

What is ContentResult?

ViewResult represents a complete HTML response whereas ContentResult represents a scalar text response. It’s just like returning pure string. Difference is ContentResult is aActionResult wrapper around string result. ContentResult is also the child of ActionResult.


Model:
In Asp.Net MVC model represent the business data.




No comments:

Post a Comment