public async Task <GetUserResult> GetUser(string userId, CancellationToken token) { var userCursor = await _users.FindAsync(u => u.Id == userId, cancellationToken : token); var user = await userCursor.FirstOrDefaultAsync(token); return(user == null?GetUserResult.Failed() : GetUserResult.Success(user)); }
public async Task <GetUserResult> GetUser(GetUserRequest request, CancellationToken token) { var userCursor = await _users.FindAsync(u => u.Login == request.Login && u.Password == request.Password, cancellationToken : token); var user = await userCursor.FirstOrDefaultAsync(token); return(user == null?GetUserResult.Failed() : GetUserResult.Success(user)); }