private void ListBox_Loaded(object sender, RoutedEventArgs e) { subjectManager = new SubjectManager(); var subjects = subjectManager .GetAllSubjects() .Include(subject => subject.QuestionAnswers) .ThenInclude(answer => answer.Question) .OrderBy(s => s.Nickname) .ToList(); listBoxSubjects.ItemsSource = subjects; }
private void SearchBox_TextChanged(object sender, TextChangedEventArgs e) { string searchFor = SearchBox.Text.ToLower(); var subjects = subjectManager .GetAllSubjects() .Include(subject => subject.QuestionAnswers) .ThenInclude(answer => answer.Question) .OrderBy(s => s.Nickname) .Where(s => s.Nickname.ToLower().StartsWith(searchFor)) .ToList(); listBoxSubjects.ItemsSource = subjects; }
public IActionResult SubjectIndex() { var subject = SubjectManager.GetAllSubjects().Select(s => s.ToModel()).ToList(); return(View(subject)); }
public ActionResult Subjects_Select(long id) { FeatureManager featureManager = new FeatureManager(); // DATA Feature feature = featureManager.GetFeatureById(id); List<FeaturePermissionGridRowModel> featurePermissions = new List<FeaturePermissionGridRowModel>(); if (feature != null) { PermissionManager permissionManager = new PermissionManager(); SubjectManager subjectManager = new SubjectManager(); IQueryable<Subject> data = subjectManager.GetAllSubjects(); data.ToList().ForEach(s => featurePermissions.Add(FeaturePermissionGridRowModel.Convert(s, feature, permissionManager.GetFeaturePermissionType(s.Id, feature.Id), permissionManager.HasSubjectFeatureAccess(s.Id, feature.Id)))); } return View(new GridModel<FeaturePermissionGridRowModel> { Data = featurePermissions }); }
public ActionResult Subjects_Select(long dataId, long entityId) { EntityManager entityManager = new EntityManager(); PermissionManager permissionManager = new PermissionManager(); SubjectManager subjectManager = new SubjectManager(); List<DataPermissionGridRowModel> subjects = new List<DataPermissionGridRowModel>(); IQueryable<Subject> data = subjectManager.GetAllSubjects(); data.ToList().ForEach(s => subjects.Add(DataPermissionGridRowModel.Convert(dataId, entityManager.GetEntityById(entityId), s, permissionManager.GetAllRights(s.Id, entityId, dataId).ToList()))); return View(new GridModel<DataPermissionGridRowModel> { Data = subjects }); }