public static List<Models.ActiveImagingTask> ReadUnicasts(int userId, string taskType)
{
using (var uow = new DAL.UnitOfWork())
{
//Admins see all tasks
List<Models.ActiveImagingTask> activeImagingTasks;
if (BLL.User.IsAdmin(userId))
{
activeImagingTasks = uow.ActiveImagingTaskRepository.Get(t => t.Type == taskType,
orderBy: q => q.OrderBy(t => t.ComputerId));
}
else
{
activeImagingTasks = uow.ActiveImagingTaskRepository.Get(t => t.Type == taskType && t.UserId == userId,
orderBy: q => q.OrderBy(t => t.ComputerId));
}
foreach (var task in activeImagingTasks)
{
task.Computer = BLL.Computer.GetComputer(task.ComputerId);
}
return activeImagingTasks;
}
}