public Task<HttpResponseMessage> Post([FromBody]dynamic body) { var command = new RegisterUserCommand( username: (string)body.username, password: (string)body.password ); _service.Register(command); return CreateResponse(HttpStatusCode.OK, command); }
public User Register(RegisterUserCommand command) { var user = new User(command.Username, command.Password); user.Register(); _repository.Register(user); if (Commit()) { DomainEvent.Raise(new UserRegistered(user)); return user; } return null; }