Exemple #1
0
        public ActionResult Read(BaseUserSessionViewModel baseUserSessionViewModel)
        {
            // Initialize
            questStatus status = null;

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Log Operation
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = LogOperation();
            if (!questStatusDef.IsSuccess(status))
            {
                // TODO
                throw new Exception("LogOperation failed");
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(baseUserSessionViewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                // TODO
                throw new Exception("Authorize failed");
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Perform operation.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            LogSettingsViewModel     logSettingsViewModel     = null;
            LogSettingsEditorModeler logSettingsEditorModeler = new LogSettingsEditorModeler(this.Request, this.UserSession);

            status = logSettingsEditorModeler.Read(baseUserSessionViewModel, out logSettingsViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                logSettingsViewModel.questStatus = status;
                return(Json(logSettingsViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return result.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = new questStatus(Severity.Success);
            logSettingsViewModel.questStatus = status;
            return(Json(logSettingsViewModel, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public ActionResult Save(LogSettingsViewModel logSettingsViewModel)
        {
            questStatus status = null;

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Log Operation
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = LogOperation();
            if (!questStatusDef.IsSuccess(status))
            {
                logSettingsViewModel.questStatus = status;
                return(Json(logSettingsViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(logSettingsViewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                logSettingsViewModel.questStatus = status;
                return(Json(logSettingsViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Perform operation.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            LogSettingsEditorModeler logSettingsEditorModeler = new LogSettingsEditorModeler(this.Request, this.UserSession);

            status = logSettingsEditorModeler.Save(logSettingsViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                logSettingsViewModel.questStatus = status;
                return(Json(logSettingsViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return result.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = new questStatus(Severity.Success, "Log settings successfully saved");
            logSettingsViewModel.questStatus = status;
            return(Json(logSettingsViewModel, JsonRequestBehavior.AllowGet));
        }