2017-10-09 10:41:38 +02:00
|
|
|
unit WebSiteControllerU;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
MVCFramework, System.Diagnostics, System.JSON, MVCFramework.Commons;
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
|
|
[MVCPath('/')]
|
|
|
|
TWebSiteController = class(TMVCController)
|
|
|
|
public
|
|
|
|
[MVCPath('/')]
|
|
|
|
[MVCHTTPMethods([httpGET])]
|
|
|
|
procedure Index;
|
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
{ TWebSiteController }
|
|
|
|
|
|
|
|
uses System.SysUtils, Web.HTTPApp, MyDataModuleU;
|
|
|
|
|
|
|
|
procedure TWebSiteController.Index;
|
|
|
|
var
|
|
|
|
lDM: TMyDataModule;
|
|
|
|
begin
|
|
|
|
ContentType := BuildContentType(TMVCMediaType.TEXT_HTML, tmvcCharSet.UTF_8);
|
|
|
|
lDM := TMyDataModule.Create(nil);
|
|
|
|
try
|
|
|
|
lDM.qryCustomers.Open;
|
2024-04-04 16:21:45 +02:00
|
|
|
ViewData['people'] := lDM.qryCustomers;
|
2017-10-09 10:41:38 +02:00
|
|
|
LoadView(['header', 'people_list', 'footer']);
|
|
|
|
finally
|
|
|
|
lDM.Free;
|
|
|
|
end;
|
|
|
|
RenderResponseStream; // rember to call RenderResponseStream!!!
|
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|