Articles → ASP.NET CORE → Page Model In Asp.Net Core
Page Model In Asp.Net Core
Purpose
Benefit Of Page Model
- As business logic and UI elements are in separate files, maintaining the code is easier.
- It provides the flexibility for developers to work on views and page models separately.
- The page model class facilitates automated unit testing.
How Is The Page Model Specified In The View?
Click to Enlarge
Click to Enlarge
Method To Write Business Logic
- OnGet
- OnPost
- OnPut
public void OnGet() {
}
public void OnPut() {
}
public void OnPost() {
}