Ejemplo n.º 1
0
        public async Task <ActionResult> Register([FromBody] RegisterAccountModel accountModel)
        {
            var account = Map <Account>(accountModel);

            var result = await _service.CreateAccountAsync(account);

            if (!result.Sucess)
            {
                return(BadRequest(result.Errors));
            }

            return(new StatusCodeResult(StatusCodes.Status201Created));
        }
        public async Task <IActionResult> CreateAccount([FromBody] CreateAccountDTO model)
        {
            var accountId = await _accountApplicationService.CreateAccountAsync(model.HolderName);

            return(Ok(accountId));
        }
        public async Task <HttpResponseMessage> PostAsync([FromBody] NewAccountModel account)
        {
            var result = await _accountApplicationService.CreateAccountAsync(Mapper.Map <User>(account));

            return(Request.CreateResponse(HttpStatusCode.Created, Mapper.Map <NewAccountResultModel>(result)));
        }