mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 16:25:54 +01:00
80a0bc8f8c
ObjectMappers DataSetToObject support boolean types Sample\SoapRest Example application server providing both SOAP and REST webservices
50 lines
1.0 KiB
ObjectPascal
50 lines
1.0 KiB
ObjectPascal
unit RESTControllerCustomerU;
|
|
|
|
interface
|
|
|
|
uses
|
|
MVCFramework, WSHelperCustomersU;
|
|
|
|
type
|
|
|
|
[MVCPath('/customers')]
|
|
TControllerCustomer = class(TMVCController)
|
|
private
|
|
FWSHelperCustomers: TWSHelperCustomers;
|
|
protected
|
|
procedure OnBeforeAction(Context: TWebContext; const AActionNAme: string;
|
|
var Handled: Boolean); override;
|
|
procedure OnAfterAction(Context: TWebContext;
|
|
const AActionNAme: string); override;
|
|
|
|
public
|
|
[MVCPath]
|
|
[MVCHTTPMethod([httpGET])]
|
|
procedure GetCustomers(ctx: TWebContext);
|
|
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
System.SysUtils, BOCustomersU;
|
|
|
|
procedure TControllerCustomer.OnBeforeAction(Context: TWebContext;
|
|
const AActionNAme: string; var Handled: Boolean);
|
|
begin
|
|
FWSHelperCustomers := TWSHelperCustomers.Create;
|
|
end;
|
|
|
|
procedure TControllerCustomer.OnAfterAction(Context: TWebContext;
|
|
const AActionNAme: string);
|
|
begin
|
|
FreeAndNil(FWSHelperCustomers);
|
|
end;
|
|
|
|
procedure TControllerCustomer.GetCustomers(ctx: TWebContext);
|
|
begin
|
|
Render<TCustomer>(FWSHelperCustomers.GetCustomers);
|
|
end;
|
|
|
|
end.
|