/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetSessions request) { var result = _sessionManager.Sessions.Where(i => i.IsActive); if (request.SupportsRemoteControl.HasValue) { result = result.Where(i => i.SupportsRemoteControl == request.SupportsRemoteControl.Value); } if (!string.IsNullOrEmpty(request.DeviceId)) { result = result.Where(i => string.Equals(i.DeviceId, request.DeviceId, StringComparison.OrdinalIgnoreCase)); } if (request.ControllableByUserId.HasValue) { var user = _userManager.GetUserById(request.ControllableByUserId.Value); if (!user.Configuration.EnableRemoteControlOfOtherUsers) { result = result.Where(i => !i.UserId.HasValue || i.ContainsUser(request.ControllableByUserId.Value)); } } return(ToOptimizedResult(result.Select(_dtoService.GetSessionInfoDto).ToList())); }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetSessions request) { var result = _sessionManager.Sessions.Where(i => i.IsActive); if (request.SupportsRemoteControl.HasValue) { result = result.Where(i => i.SupportsRemoteControl == request.SupportsRemoteControl.Value); } return(ToOptimizedResult(result.Select(SessionInfoDtoBuilder.GetSessionInfoDto).ToList())); }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetSessions request) { var result = _sessionManager.Sessions.Where(i => i.IsActive); if (request.SupportsRemoteControl.HasValue) { result = result.Where(i => i.SupportsRemoteControl == request.SupportsRemoteControl.Value); } if (request.ControllableByUserId.HasValue) { var user = _userManager.GetUserById(request.ControllableByUserId.Value); if (!user.Configuration.EnableRemoteControlOfOtherUsers) { result = result.Where(i => i.User == null || i.User.Id == request.ControllableByUserId.Value); } } return(ToOptimizedResult(result.Select(_dtoService.GetSessionInfoDto).ToList())); }