Example #1
0
        /// <summary>
        /// Returns JsonClient. Create AppJson and process request.
        /// </summary>
        internal async Task <string> ProcessAsync(HttpContext context, AppJson appJson)
        {
            if (appJson == null)
            {
                // Create AppJson with session data.
                appJson = await CreateAppJsonSession(context);
            }

            // Process
            try
            {
                await appJson.ProcessInternalAsync(appJson);
            }
            catch (Exception exception)
            {
                appJson.BootstrapAlert(UtilFramework.ExceptionToString(exception), BootstrapAlertEnum.Error);
                appJson.IsReload = true;
            }

            // Version tag
            RenderVersion(appJson);

            // RequestCount
            appJson.RequestCount = appJson.RequestJson.RequestCount;

            // ResponseCount
            appJson.ResponseCount += 1;

            // SerializeSession, SerializeClient
            UtilSession.Serialize(appJson, out string jsonClientResponse);

            return(jsonClientResponse);
        }