示例#1
0
    protected bool Error(AccountCreateResponse response)
    {
        switch (response.errorCode)
        {
        case (int)CommonErrorCode.Auth_Add_User_Fail:
            MainUI.s_Instance.ShowInfoPopup("이미 등록된 유저 입니다. Auth_Add_User_Fail");
            return(true);

        case (int)CommonErrorCode.Auth_Fail_Not_Registered_Username:
            MainUI.s_Instance.ShowInfoPopup("레지스터에 등록시킬수없는 유저 이름입니다. Auth_Fail_Not_Registered_Username");
            return(true);

        case (int)CommonErrorCode.Auth_Fail_Mismatch_Confirm_Password:
            MainUI.s_Instance.ShowInfoPopup("재확인 비밀번호가 맞지 않습니다. Auth_Fail_Mismatch_Confirm_Password");
            return(true);
        }
        return(false);
    }
        public async Task <ActionResult <AccountCreateResponse> > Create([FromBody] AccountCreateRequest request)
        {
            request.EnsureValidation();
            AccountCreateArgs accountCreateArgs = new AccountCreateArgs
            {
                AccountCode        = request.Code,
                AccountName        = request.Name,
                AccountDescription = request.Description,
                ParentAccountId    = request.ParentId,
                DebitOrCredit      = request.DebitOrCredit,
                IsHidden           = request.IsHidden
            };
            IMediator           mediator            = Factory.Resolve <IMediator>();
            AccountCreateResult accountCreateResult = await mediator.Send(new AccountCreateCommand(accountCreateArgs));

            accountCreateResult.EnsureSuccess();
            AccountCreateResponse response = new AccountCreateResponse
            {
                IsSuccess = true
            };

            return(Ok(response));
        }
        public AccountCreateResponse CreateAccount(AccountCreateRequest request)
        {
            var response = new AccountCreateResponse();

            response.Success = true;

            try
            {
                var account = new Account
                {
                    CustomerRef = request.CustomerName
                };

                _accountRepository.Add(account);
            }
            catch
            {
                response.Success = false;
                response.Message = "Unexpected error";
            }

            return(response);
        }
示例#4
0
        public async Task <IActionResult> CreateAccount(CreateAccountRequest request)
        {
            _logger.LogInformation($"{nameof(AccountController)}.{nameof(CreateAccount)} - {request}");

            if (!ModelState.IsValid)
            {
                return(BadRequest($"Problem with CreateAccountRequest"));
            }

            if (string.IsNullOrWhiteSpace(request.Name))
            {
                return(BadRequest($"Cannot created with an empty name"));
            }

            CreateAccount createAccount =
                new CreateAccount(request.Name, Amount.FromInput(request.InitialDeposit));

            AccountCreationSummary accountCreationSummary = await _accountService.CreateAccount(createAccount);

            AccountCreateResponse response = new AccountCreateResponse(accountCreationSummary.AccountId,
                                                                       accountCreationSummary.Amount.Value, accountCreationSummary.Name);

            return(Ok(response));
        }