The DefaultController class has functions for the basic/ default behavior for the requests. In most cases you will be extending form this class.


Methods

_actionAdd (context)

private

Generic Add method This method will add a new item to the database with the data provided in the request.

Parameters

Name Type Description
context CommandContext The context of the current request.

Returned Value

Promise: A promise containing the result of the request.


_actionBrowse (context)

private

Generic Browse method. This method will get a list from the model based on the current request.

Parameters

Name Type Description
context CommandContext The context of the current request.

Returned Value

Promise: A promise with the rendered view.


_actionDelete (context)

private

Generic Delete method. This method tries to get a list of item(s), when this list is found, all items in this list are removed.

Parameters

Name Type Description
context CommandContext The context of the current request.

Returned Value

Promise: A promise containing the result of the request.


_actionEdit (context)

private

Generic Edit method. This method will receive an item from the database, add the new data to this object, and update it in the database.

Parameters

Name Type Description
context CommandContext The context of the current request.

Returned Value

Promise: A promise containing the result of the request.


_actionGet (context)

private

Generic GET method. This method will check if the request is unique or not, if it is unique then a read action is excuted. else a browse function is executed.

Parameters

Name Type Description
context CommandContext The context of the current request.

Returned Value

Promise: A promise with the rendered view.


_actionPost (context)

private

Generic Post method. This method will check if the next method is to be an add or edit and will forward the request as such.

Parameters

Name Type Description
context CommandContext The context of the current request.

Returned Value

Promise: A promise containing the result of the call.


_actionRead (context)

private

Generic Read method. This method will get an item from the model based on the current request, if the item isn't found a 404 is returned.

Parameters

Name Type Description
context CommandContext The context of the current request.

Returned Value

Promise: A promise with the rendered view.