Skip to content

MVC Routing Schema

Eitan Blumin edited this page Mar 13, 2019 · 4 revisions

NOTE: This page is work-in-progress and is subject to change frequently

This page describes the general schema of controller routes in the portal.

General Schema

In general, the routing schema of the portal would be in the following structure:

{controller=Home}/{dataview_or_page_slug}/{action=List}/{id?}

  • controller : Will determine the type of controller requested. "Home" is the default which is the home page.
  • dataview_or_page_slug : Will determine which data view or custom page is currently being accessed. No default.
  • action : Will determine the type of action being requested for the data view. "List" is the default which is the grid/datatable module.
  • id? : If a specific record within a data view is being browsed, edited, or manipulated, the id parameter will receive the Primary Key of the specific record.

Controllers

The following are the available controllers used for routing:

View

This controller contains front-facing modules for accessing data views and working with their data (in other words: the "view" part of MVC).

Actions:

Action Method Description Examples
List GET The default dataview action. Used for displaying the records in the data view in a grid (datatable). Example: View/Members and View/Members/List would do the same thing which is display in a datatable the records of a dataview called "Members". The id parameter for this action will be used as the identifier of a query (i.e. "Selection"). View/Members/List/Inactive would display in the datatable all the records matching the criteria defined in a query called "Inactive"
Browse GET Will be used for browsing the details of a single data record at a time. View/Members/Browse/123 would be a route for browsing the details of record with ID "123" in a dataview called "Members".
Edit GET Used for displaying a record's editing page. View/Orders/Edit/456 would be a route for editing the details of record with ID "456" in a dataview called "Orders".
Add GET Same as the Edit action, except for adding a new record. The optional id parameter in this case will be used for "cloning" an existing record with that ID (in other words: pre-fill the fields of the form with details from the specified existing record, but use the form for adding a new record). View/Agents/Add would display a clean form for adding a new record in the "Agents" dataview. Another example: View/Agents/Add/789 would display a form for adding a new record in the "Agents" dataview, but will also pre-fill the fields with the details of an existing record ID "789".
Selections GET Will display the list of queries ("Selections") defined for the dataview. The optional id parameter will be used as the identifier of a specific Query Group, displaying only the queries within it. If none was specified, all query groups will be displayed instead. View/Wines/Selections will display a list of query groups for the "Wines" dataview. View/Wines/Selections/French-Brands will display the queries within the query group identified as "French-Brands".
Charts GET Will display the charts defined for the dataview. The optional id parameter will be used as the identifier of a single chart, which would be displayed in large view across the whole page (instead of, otherwise, in a list of charts). View/Orders/Charts will display the charts defined for a dataview called "Orders".

API

This is an API controller for returning data from specific dataviews. This is the API that would be used for retrieving data for the View controller. In other words: the "controller" part of MVC.

The data returned will be formatted in JSON.

Actions:

Action Method Description Examples
List GET The default API action. Used for returning the records in a data view. The id parameter for this action will be used as the identifier of a query (i.e. "Selection"). api/Members and api/Members/List would do the same thing which is return all records of a dataview called "Members". api/Members/List/Inactive would return all the records matching the criteria defined in a query called "Inactive".
Browse GET Will be used for returning the details of a single data record at a time. api/Members/Browse/123 would return the details of record with ID "123" in a dataview called "Members".
Edit POST Used for updating a single record. api/Orders/Edit/456 would be a route for accepting the updated details of record with ID "456" in a dataview called "Orders".
Add POST Same as the Edit action, except for adding a new record. The id parameter in this case will not be used. api/Agents/Add would accept the details of a new record in the "Agents" dataview.
Selections GET Will return the list of queries ("Selections") defined for the dataview. The optional id parameter will be used as the identifier of a specific Query Group, returning only the queries within it. If none was specified, all query groups will be displayed instead. api/Wines/Selections will return a list of query groups for the "Wines" dataview. api/Wines/Selections/French-Brands will return the queries within the query group identified as "French-Brands".
Charts GET Will return the charts defined for the dataview. The optional id parameter will be used as the identifier of a single chart, to filter the results. api/Orders/Charts will display the charts defined for a dataview called "Orders". Example: api/Orders/Charts/123
Action POST Will be used for the execution of dataview actions of DB types (executing a SQL command or stored procedure). The id parameter is mandatory and used for identifying the action to be executed. In the POST body, the action parameter values will be expected in json format. api/Orders/Action/555 would be used for executing action with ID "555" belonging to dataview called "Orders". Its parameters would be expected in JSON format as the POST body. Example: { "parameters": [ {"parameter": "orderId", "value": "87665"}, {"parameter": "newStatus", "value": "complete"} ] }

Account

TBA

Page

TBA

TBA