delphimvcframework/samples/jsonrpc/MainControllerU.pas
2017-09-24 19:41:23 +02:00

36 lines
698 B
ObjectPascal

unit MainControllerU;
interface
uses
MVCFramework, MVCFramework.Commons, MVCFramework.JSONRPC, JsonDataObjects;
type
TMyDerivedController = class(TMVCJSONRPCController)
public
function Subtract(aParams: TMVCJSONArray): Integer;
procedure DoSomething;
end;
implementation
uses
System.SysUtils, MVCFramework.Logger, System.StrUtils;
{ TMyDerivedController }
procedure TMyDerivedController.DoSomething;
begin
end;
function TMyDerivedController.Subtract(aParams: TMVCJSONArray): Integer;
begin
if aParams.Count <> 2 then
raise EMVCJSONRPCException.Create('Method "subtract" expects exactly 2 params');
Result := aParams[0].IntValue - aParams[1].IntValue;
end;
end.