From 4035859bde5454355061bdcae71332a21099c23b Mon Sep 17 00:00:00 2001 From: Daniele Teti Date: Wed, 15 Jan 2025 23:22:10 +0100 Subject: [PATCH] session_on_database allows for heavy changes of session --- samples/sessions_on_database/AppControllerU.pas | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/samples/sessions_on_database/AppControllerU.pas b/samples/sessions_on_database/AppControllerU.pas index 1ed6c7da..e962c9ec 100644 --- a/samples/sessions_on_database/AppControllerU.pas +++ b/samples/sessions_on_database/AppControllerU.pas @@ -16,6 +16,10 @@ TApp1MainController = class(TMVCController) [MVCHTTPMethod([httpGET])] function Index: String; + [MVCPath('/inc')] + [MVCHTTPMethod([httpGET])] + function DoInc: String; + [MVCPath('/started')] [MVCHTTPMethod([httpGET])] function GetStarted: String; @@ -33,7 +37,7 @@ TApp1MainController = class(TMVCController) implementation uses - TemplatePro; + TemplatePro, System.SysUtils; { TApp1MainController } @@ -69,4 +73,15 @@ function TApp1MainController.Index: String; end; end; +function TApp1MainController.DoInc: String; +begin + if Session['value'].IsEmpty then + begin + Session['value'] := '0'; + end; + Session['value'] := (Session['value'].ToInteger + 1).ToString; + Result := Session['value']; +end; + + end.