mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 07:45:54 +01:00
New template language: TemplatePro
This commit is contained in:
parent
7e28bc959e
commit
21bdc7cee0
@ -14,14 +14,14 @@ type
|
||||
[MVCPath('/api/customers')]
|
||||
TCustomersController = class(TMVCController)
|
||||
public
|
||||
[MVCPath]
|
||||
[MVCHTTPMethods([httpGET])]
|
||||
procedure GetCustomers([MVCFromQueryString('rql','')] RQLFilter: String);
|
||||
|
||||
[MVCPath('/($ID)')]
|
||||
[MVCHTTPMethods([httpGET])]
|
||||
procedure GetCustomerByID(const ID: Integer);
|
||||
|
||||
[MVCPath]
|
||||
[MVCHTTPMethods([httpGET])]
|
||||
procedure GetCustomers([MVCFromQueryString('rql','')] RQLFilter: String);
|
||||
|
||||
[MVCPath]
|
||||
[MVCHTTPMethods([httpPOST])]
|
||||
procedure CreateCustomer([MVCFromBody] const Customer: TCustomer);
|
||||
@ -74,6 +74,7 @@ begin
|
||||
Render201Created();
|
||||
except
|
||||
TMVCActiveRecord.CurrentConnection.Rollback;
|
||||
raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Delphi MVC Framework
|
||||
//
|
||||
@ -90,13 +90,10 @@ type
|
||||
FGetItemMethod: TRttiMethod;
|
||||
FGetCountMethod: TRttiMethod;
|
||||
protected
|
||||
procedure GetItemAsTValue(const AIndex: Integer; out AValue: TValue);
|
||||
function GetItem(const AIndex: Integer): TObject;
|
||||
function GetEnumerator: TDuckListEnumerator;
|
||||
function GetOwnsObjects: Boolean;
|
||||
procedure SetOwnsObjects(const AValue: Boolean);
|
||||
procedure Add(const AObject: TObject);
|
||||
function Count: Integer;
|
||||
procedure Clear;
|
||||
|
||||
function WrappedObject: TObject;
|
||||
@ -112,6 +109,9 @@ type
|
||||
destructor Destroy; override;
|
||||
|
||||
function IsWrappedList: Boolean; overload;
|
||||
function Count: Integer;
|
||||
procedure GetItemAsTValue(const AIndex: Integer; out AValue: TValue);
|
||||
function GetItem(const AIndex: Integer): TObject;
|
||||
class function CanBeWrappedAsList(const AObjectAsDuck: TObject): Boolean; overload; static;
|
||||
class function CanBeWrappedAsList(const AObjectAsDuck: TObject; out AMVCList: IMVCList): Boolean; overload; static;
|
||||
class function CanBeWrappedAsList(const AInterfaceAsDuck: IInterface): Boolean; overload; static;
|
||||
@ -292,7 +292,6 @@ begin
|
||||
raise EMVCDuckTypingException.Create
|
||||
('Cannot find method Indexed property "Items" or method "GetItem" or method "GetElement" in the Duck Object.');
|
||||
GetItemAsTValue(AIndex, lValue);
|
||||
// lValue := FGetItemMethod.Invoke(FObjectAsDuck, [AIndex]);
|
||||
|
||||
if lValue.Kind = tkInterface then
|
||||
begin
|
||||
@ -431,7 +430,7 @@ var
|
||||
List: IMVCList;
|
||||
begin
|
||||
if AObjectAsDuck is TDuckTypedList then
|
||||
Exit(AObjectAsDuck as TDuckTypedList);
|
||||
Exit(TDuckTypedList(AObjectAsDuck));
|
||||
Result := nil;
|
||||
List := TDuckTypedList.Create(AObjectAsDuck, AOwnsObject);
|
||||
if List.IsWrappedList then
|
||||
|
1230
sources/MVCFramework.TemplatePro.pas
Normal file
1230
sources/MVCFramework.TemplatePro.pas
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user