public async Task <IActionResult> GetAccountByUserId(Guid id) { var userInfo = this.GetUserInfo(); if (userInfo is null) { return(BadRequest("No token found!")); } var query = new GetAccountByUserIdQuery(userInfo.UserId); var result = await _mediator.Send(query); return(Ok(result)); }
public async Task <ActionResult <Account> > GetByUserId(string id) { try { var query = new GetAccountByUserIdQuery(id); var result = await _mediator.Send(query); _logger.LogInformation("Get account by user id " + id + " request"); return(result != null ? (ActionResult <Account>)Ok(result) : NotFound()); } catch (Exception e) { _logger.LogInformation("Error while account creating"); return(NotFound()); } }