public async Task <IActionResult> Post([FromBody] CreateUserModel model)
        {
            var createUserRequest = new CreateUserRequest(model.UserName, model.Password, model.Roles);
            await _createUserUseCase.Handle(createUserRequest, _createUserPresenter);

            return(_createUserPresenter.ActionResult);
        }
Beispiel #2
0
        public async Task <IActionResult> Post([FromBody] NewUserCommand command)
        {
            if (ModelState.IsValid)
            {
                await _createUserUseCase.Handle(
                    new CreateUserRequest(command.Email, command.PasswordHash),
                    _createUserPresenter
                    );

                if (_createUserPresenter.Succeeded)
                {
                    return(Created($"api/user/{_createUserPresenter.Id}", _createUserPresenter.ContentResult));
                }
                else
                {
                    return(_createUserPresenter.ContentResult);
                }
            }

            return(BadRequest(ModelState));
        }
Beispiel #3
0
 public async Task <bool> Create(CreateUserRequest message, IOutputPort <CreateUserResponse> outputPort)
 {
     return(await _createUserUseCase.Handle(message, outputPort));
 }