public CreateAuthKeyResponse CreateAuthKey(CreateAuthKeyRequest request)
        {
            CreateAuthKeyResponse response = new CreateAuthKeyResponse
            {
                Success = true,
                Error   = ""
            };

            User_Keys key = Mapper.Map <User_Keys>(request.AuthKey);

            User_Keys DbKey = db.User_Keys.FirstOrDefault(k => k.UserNr == key.UserNr && k.ExchangeType == key.ExchangeType);

            if (DbKey != null)
            {
                response.Success = false;
                response.Error   = "A key for that exchange already exists";
                return(response);
            }

            try
            {
                db.User_Keys.Add(key);
                db.SaveChanges();
            }
            catch (Exception e)
            {
                _logger.ErrorFormat($"error happend error: {e.Message} stacktrace: {e.StackTrace}");
                response.Success = false;
                response.Error   = "An error occured in user creation please check logs for more details";
            }

            return(response);
        }
예제 #2
0
        public CreateAuthKeyResponse CreateAuthKey(CreateAuthKeyRequest request)
        {
            RestRequest restRequest = new RestRequest("Account/CreateAuthKey", Method.POST);

            restRequest.AddJsonBody(request);

            CreateAuthKeyResponse response = _client.Execute <CreateAuthKeyResponse>(restRequest).Data;

            return(response);
        }
예제 #3
0
        public CreateAuthKeyResponse CreateAuthKey(CreateAuthKeyData data)
        {
            CreateAuthKeyRequest request = new CreateAuthKeyRequest
            {
                AuthKey = new AuthKey
                {
                    UserNr       = GetUserAuthenticationData().UserNr,
                    ExchangeType = data.ExchangeType,
                    KeyValue     = data.KeyValue,
                    SecretValue  = data.SecretValue
                }
            };

            CreateAuthKeyResponse response = _client.CreateAuthKey(request);

            return(response);
        }
예제 #4
0
        public CreateAuthKeyResponse CreateAuthKey([FromBody] CreateAuthKeyRequest request)
        {
            CreateAuthKeyResponse response = _accountFacade.CreateAuthKey(request);

            return(response);
        }