public Task <UserSummary> ExecuteAsync(GetCurrentUserSummaryQuery query, IExecutionContext executionContext) { if (!executionContext.UserContext.UserId.HasValue) { return(null); } var userQuery = new GetUserSummaryByIdQuery(executionContext.UserContext.UserId.Value); return(_queryExecutor.ExecuteAsync(userQuery, executionContext)); }
/// <summary> /// Finds a user by a database id returning a UserSummary object if it /// is found, otherwise null. /// </summary> /// <param name="executionContext">Optional execution context to use when executing the query. Useful if you need to temporarily elevate your permission level.</param> public Task <UserSummary> GetUserSummaryByIdAsync(int userId, IExecutionContext executionContext = null) { var query = new GetUserSummaryByIdQuery(userId); return(_queryExecutor.ExecuteAsync(query, executionContext)); }