You may query or update the database, send e-mails, process files or user input, or even launch a rocket to Mars.
Typically there is a logic to update/insert/delete/list records from/to database, but it may be literally anything there. At the end of Action, if you want to display soemthing (besides the static content of View) you need to initialize the variable Model and include the View as the last line of the Action.
Business objects often are stored in Classes and use the Active Record pattern. Project ID = record("Project ID") set Populate Object From Record = obj end if end function end class 'User Helper When we need to save the data of object into the database, the reverse process is performed: the SQL Update query is executed with attributes of the object and it's ID.
When the data is needed from the database, one row is fetched from table into the object: Class User private m Id private m First Name ... Command Text = "Select * from [User]" set records = obj Command. If there is a need to process several records, then the objects are joined into the List or Dictionary.
There should be a number of controllers in the Application.
Controllers must have names ending with Controller: .
public property get Id() Id = m Id end property public property let Id(val) m Id = val end property public property get First Name() First Name = m First Name end property public property let First Name(val) m First Name = val end property ... Execute if then Set Select All = Nothing else Dim results, obj, record Set results = Server. Dictionary") while not set obj = Populate Object From Record(records) results. Id, obj records.movenext wend set Select All = results records. It is very easy to generate skeletons of classes for your project with the basic set of database operations. When the Controller/Action perform the business logic (read/write the database, process user input etc) they may need to display something in the corresponding View.
Close End If end function private function Populate Object From Record(record) if then Set Populate Object From Record = Nothing else Dim obj set obj = new User obj. The advantage of this approach is the ability to split the Data Model from the HTML (appearance) and from the business logic (Controller/View). So the Controller prepares the Model to pass it to the View. The representation of of the narrower Model term is a variable that has the same name Model, but may hold specific types of the value for every specific Action-View pair.The aim of this effort is to bring MVC concept to ASP. Router is a code that decides which Controller and Action to call.To give a way to write/re-write the ASP app in MVC-like style. To let newcomers recognize the common code-patterns and pick up the support of existing ASP apps easier. Let's study the Router with comparison MVC and classic scripting.Look at the example below: If the user hits the link controller=User&action=List , Router selects the User Controller and List action. Have a fullscreen or mobile view (or both) without necessity to touch the business logic code.Controller should handle user input, query and update the object model and prepare the data to be displayed.