private List <JobQueueViewModel> GetJbQueues(AccountViewModel account) { if (account == null || account.GroupSettingsId == null) { return(null); } var jobQueues = _jobQueueService.GetQueuesByAccountId(new JobQueueViewModel { AccountId = account.Id, IsForSpy = false }); var enabledGroupFunctions = new GetGroupFunctionsByGroupIdQueryHandler(new DataBaseContext()).Handle( new GetGroupFunctionsByGroupIdQuery { GroupId = (long)account.GroupSettingsId }); var result = enabledGroupFunctions.Select(queue => new JobQueueViewModel { FunctionName = queue, FunctionStringName = new GetFunctionNameByNameQueryHandler(new DataBaseContext()).Handle(new GetFunctionNameByNameQuery { FunctionName = queue }), IsProcessed = jobQueues.Any(model => model.FunctionName == queue && model.IsProcessed) }).ToList(); return(result); }
public List <FunctionViewModel> GetEnabledFunctionsByGroupId(long groupId) { var functions = new GetGroupFunctionsByGroupIdQueryHandler(new DataBaseContext()).Handle(new GetGroupFunctionsByGroupIdQuery { GroupId = groupId }); var result = functions.Select(function => new FunctionViewModel { Name = function.Name, FunctionName = function.FunctionName, FunctionId = function.FunctionId }).ToList(); return(result); }