private QuestionListModel<Thread> GetCategoryQuestionListModel(int? categoryId = null, [QueryParameter]GridSortOptions sortOptions = null, [QueryParameter]int? page = null, ThreadSanitizationStatus? state = null) { var availableCategories = Repository.Category.All(); var filterCategories = availableCategories; if (categoryId > 0 && availableCategories.Any(c => c.Id == categoryId)) { var selectedCategory = availableCategories.Single(c => c.Id == categoryId); filterCategories = new List<Category> { selectedCategory }; } var questionListModel = GetQuestionListModel(t => t.ByCategories(filterCategories).BySanitizationStatus(state), sortOptions, page); return new QuestionListModel<Thread>(availableCategories) { GridModel = questionListModel, SelectedCategory = categoryId != null ? availableCategories.Single(c => c.Id == categoryId) : null }; }
public virtual ActionResult SanitizationUpdateThread(int threadId, ThreadSanitizationStatus sanitizationStatus) { var thread = Repository.Thread.Get(threadId); thread.SanitizationStatus = sanitizationStatus; Repository.Thread.Update(thread); return new EmptyResult(); }
public virtual ActionResult SanitizationQuestionList(ThreadSanitizationStatus? sanitizationStatus = null, [QueryParameter]GridSortOptions sortOptions = null, [QueryParameter]int? page = null) { var questionListModel = GetQuestionListModel(t => t.BySanitizationStatus(sanitizationStatus ?? ThreadSanitizationStatus.NotSanitized).ByState(ThreadState.Closed), sortOptions, page); var model = new SanitizationQuestionListModel { GridModel = questionListModel, SelectedStatus = sanitizationStatus ?? ThreadSanitizationStatus.NotSanitized }; return View(model); }