Example #1
0
        public async Task <ValidMailResult> DoValidMail(ValidMailInfo request)
        {
            try
            {
                var lastSendTime = (DateTime.UtcNow - _lastTime).TotalSeconds;
                if (lastSendTime <= 90)
                {
                    throw new Exception(
                              $"You need to wait at least 90 seconds before asking to resend an confirmation key! Last request was {lastSendTime} seconds ago.");
                }

                var result = await _dataExchange.DoDataExchange <ValidMailResult, ValidMailInfo>(request, CmdName);

                if (result.Result)
                {
                    _lastTime = DateTime.UtcNow;
                }

                return(result);
            }
            catch (Exception e)
            {
                return(new ValidMailResult(false, e.Message));
            }
        }
Example #2
0
        public async Task <ResetPwdResult> DoResetPwd(ResetPwdInfo request)
        {
            try
            {
                var lastSendTime = (DateTime.UtcNow - _lastTime).TotalSeconds;
                if (lastSendTime <= 90)
                {
                    throw new Exception(
                              $"You need to wait at least 90 seconds before asking to resend an new password! Last request was {lastSendTime} seconds ago.");
                }

                var result = await _dataExchange.DoDataExchange <ResetPwdResult, ResetPwdInfo>(request, CmdName);

                if (result.Result)
                {
                    _lastTime = DateTime.UtcNow;
                }

                return(result);
            }
            catch (Exception e)
            {
                return(new ResetPwdResult(false, e.Message));
            }
        }
Example #3
0
        public async Task <ChangePwdResult> DoChangePwd(ChangePwdInfo request)
        {
            try
            {
                var lastSendTime = (DateTime.UtcNow - _lastTime).TotalSeconds;
                if (lastSendTime <= 90)
                {
                    throw new Exception(
                              $"You need to wait at least 90 seconds before to try again! Last try was {lastSendTime} seconds ago.");
                }

                dynamic requestInfo = request;

                var result = await _dataExchange.DoDataExchange <ChangePwdResult, ChangePwdInfo>(request, CmdName);

                if (result.Result)
                {
                    _lastTime = DateTime.UtcNow;
                }

                return(result);
            }
            catch (Exception e)
            {
                return(new ChangePwdResult(false, e.Message));
            }
        }
Example #4
0
 public async Task <LoginResult> DoLogin(LoginInfo request)
 {
     try
     {
         return(await _dataExchange.DoDataExchange <LoginResult, LoginInfo>(request, CmdName));
     }
     catch (Exception e)
     {
         return(new LoginResult(false, e.Message));
     }
 }
 public async Task <ConfirmFriendResult> DoConfirmFriend(ConfirmFriendInfo request)
 {
     try
     {
         return(await _dataExchange.DoDataExchange <ConfirmFriendResult, ConfirmFriendInfo>(request, CmdName));
     }
     catch (Exception e)
     {
         return(new ConfirmFriendResult(false, e.Message));
     }
 }
Example #6
0
 public async Task <GetFriendsResult> DoGetFriends(GetFriendsInfo request)
 {
     try
     {
         return(await _dataExchange.DoDataExchange <GetFriendsResult, GetFriendsInfo>(request, CmdName));
     }
     catch (Exception e)
     {
         return(new GetFriendsResult(false, e.Message));
     }
 }
Example #7
0
 public async Task <RemoveFriendResult> DoRemoveFriend(RemoveFriendInfo request)
 {
     try
     {
         return(await _dataExchange.DoDataExchange <RemoveFriendResult, RemoveFriendInfo>(request, CmdName));
     }
     catch (Exception e)
     {
         return(new RemoveFriendResult(false, e.Message));
     }
 }