public async Task<IActionResult> Register(UserModel userModel) { if (!ModelState.IsValid) { return ErrorResult(); } var command = new RegisterUserCommand(userModel.UserName, userModel.EMail, userModel.Password); var result = await _messageDispatcher.Execute(command); return ErrorResult(result); }
public async Task<IActionResult> Get(UserModel userModel) { var identifier = User.FindFirstValue(ClaimTypes.NameIdentifier); if (string.IsNullOrEmpty(identifier)) { return BadRequest(); } var query = new UserByIdQuery(Guid.Parse(identifier)); var user = await _messageDispatcher.Execute(query); return Json(user); }