コード例 #1
0
ファイル: LoginToken.cs プロジェクト: NTDLS/MammutDB
        public LoginToken(ActionResponceLogin response)
        {
            if (response.Success == false)
            {
                throw new Exception("The login response does not contain a valid login token.");
            }

            this.SessionId = response.SessionId;

            this.isValid = true;
        }
コード例 #2
0
        public ActionResponceLogin Login([FromBody] ActionRequestLogin action)
        {
            _logger.LogDebug($"API:{MammutUtility.GetCurrentMethod()}");

            var result = new ActionResponceLogin();

            try
            {
                var session = _core.Security.Login(action.Login);
                result.SessionId = session.SessionId;
                result.LoginId   = session.LoginId;
                result.Success   = true;
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Message = "Call failed with an exception: " + ex.Message;
                _logger.LogError(result.Message);
            }
            return(result);
        }