mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 07:45:54 +01:00
Update README.md
This commit is contained in:
parent
965c945a7a
commit
400b6ab69a
25
README.md
25
README.md
@ -103,13 +103,21 @@ type
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
procedure GetUsers(CTX: TWebContext);
|
||||
|
||||
//The following action will be with a POST or PUT request like the following
|
||||
//The following action will be with a PUT request like the following
|
||||
//http://myserver.com/users/3
|
||||
//and in the request body there should be a serialized TUser
|
||||
[MVCPath('/($id)')]
|
||||
[MVCProduce('application/json')]
|
||||
[MVCHTTPMethod([httPOST, httpPUT])]
|
||||
procedure UpdateOrCreateUser(CTX: TWebContext);
|
||||
[MVCHTTPMethod([httpPUT])]
|
||||
procedure UpdateUser(CTX: TWebContext);
|
||||
|
||||
//The following action will respond to a POST request like the following
|
||||
//http://myserver.com/users
|
||||
//and in the request body there should be the new user to create as json
|
||||
[MVCPath]
|
||||
[MVCProduce('application/json')]
|
||||
[MVCHTTPMethod([httpPOST])]
|
||||
procedure CreateUser(CTX: TWebContext);
|
||||
|
||||
end;
|
||||
|
||||
@ -128,7 +136,7 @@ begin
|
||||
Render(User);
|
||||
end;
|
||||
|
||||
procedure TUsersController.UpdateOrCreateUser(CTX: TWebContext);
|
||||
procedure TUsersController.UpdateUser(CTX: TWebContext);
|
||||
var
|
||||
User: TUser;
|
||||
begin
|
||||
@ -137,6 +145,15 @@ begin
|
||||
Render(User);
|
||||
end;
|
||||
|
||||
procedure TUsersController.CreateUser(CTX: TWebContext);
|
||||
var
|
||||
User: TUser;
|
||||
begin
|
||||
User := CTX.Request.BodyAs<TUser>;
|
||||
CreateUser(User);
|
||||
Render(User);
|
||||
end;
|
||||
|
||||
end.
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user