mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 00:05:53 +01:00
41 lines
887 B
ObjectPascal
41 lines
887 B
ObjectPascal
unit RoutingSampleControllerU;
|
|
|
|
interface
|
|
|
|
uses
|
|
MVCFramework, MVCFramework.Commons;
|
|
|
|
type
|
|
|
|
[MVCPath('/')]
|
|
TRoutingSampleController = class(TMVCController)
|
|
public
|
|
[MVCHTTPMethod([httpGet])]
|
|
[MVCPath('/($searchtext)/($page)')]
|
|
[MVCProduce('text/plain')]
|
|
procedure SearchCustomers(CTX: TWebContext);
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
System.SysUtils;
|
|
|
|
{ TRoutingSampleController }
|
|
|
|
procedure TRoutingSampleController.SearchCustomers(CTX: TWebContext);
|
|
var
|
|
search: string;
|
|
p: Integer;
|
|
orderby: string;
|
|
begin
|
|
search := CTX.Request.Params['searchtext'];
|
|
p := CTX.Request.ParamsAsInteger['page'];
|
|
orderby := '';
|
|
if CTX.Request.QueryStringParamExists('order') then
|
|
orderby := CTX.Request.QueryStringParam('order');
|
|
Render(Format('SEARCHTEXT: "%s", PAGE: %d, ORDERBYFIELD: "%s"', [search, p, orderby]));
|
|
end;
|
|
|
|
end.
|