public virtual ActionResult LatestTopics(int?p) { var loggedOnReadOnlyUser = User.GetMembershipUser(MembershipService); var loggedOnUsersRole = loggedOnReadOnlyUser.GetRole(RoleService); var allowedCategories = _categoryService.GetAllowedCategories(loggedOnUsersRole); var settings = SettingsService.GetSettings(); // Set the page index var pageIndex = p ?? 1; // Get the topics var topics = Task.Run(() => _topicService.GetRecentTopics(pageIndex, settings.TopicsPerPage, ForumConfiguration.Instance.ActiveTopicsListSize, allowedCategories)).Result; // Get the Topic View Models var topicViewModels = ViewModelMapping.CreateTopicViewModels(topics.Where(x => x.Pending != null && !x.Pending.GetValueOrDefault()).ToList(), RoleService, loggedOnUsersRole, loggedOnReadOnlyUser, allowedCategories, settings, _postService, _notificationService, _pollService, _voteService, _favouriteService); // create the view model var viewModel = new ActiveTopicsViewModel { Topics = topicViewModels, PageIndex = pageIndex, TotalCount = topics.TotalCount, TotalPages = topics.TotalPages }; return(PartialView(viewModel)); }
public ActionResult LatestTopics(int?p) { using (UnitOfWorkManager.NewUnitOfWork()) { // Set the page index var pageIndex = p ?? 1; // Get the topics var topics = _topicService.GetRecentTopics(pageIndex, SettingsService.GetSettings().TopicsPerPage, AppConstants.ActiveTopicsListSize); // Get all the categories for this topic collection var categories = topics.Select(x => x.Category).Distinct(); // create the view model var viewModel = new ActiveTopicsViewModel { Topics = topics, AllPermissionSets = new Dictionary <Category, PermissionSet>(), PageIndex = pageIndex, TotalCount = topics.TotalCount, User = LoggedOnUser }; // loop through the categories and get the permissions foreach (var category in categories) { var permissionSet = RoleService.GetPermissions(category, UsersRole); viewModel.AllPermissionSets.Add(category, permissionSet); } return(PartialView(viewModel)); } }
public PartialViewResult LatestTopics(int?p) { using (UnitOfWorkManager.NewUnitOfWork()) { // Set the page index var pageIndex = p ?? 1; // Get the topics var topics = ServiceFactory.TopicService.GetRecentTopics(pageIndex, Dialogue.Settings().TopicsPerPage, AppConstants.ActiveTopicsListSize); // Get all the categories for this topic collection var categories = topics.Select(x => x.Category).Distinct(); // create the view model var viewModel = new ActiveTopicsViewModel { Topics = topics, AllPermissionSets = new Dictionary <Category, PermissionSet>(), PageIndex = pageIndex, TotalCount = topics.TotalCount, User = CurrentMember }; // loop through the categories and get the permissions foreach (var category in categories) { var permissionSet = ServiceFactory.PermissionService.GetPermissions(category, _membersGroups); viewModel.AllPermissionSets.Add(category, permissionSet); } return(PartialView(PathHelper.GetThemePartialViewPath("LatestTopics"), viewModel)); } }
public ActionResult PatientClubDetail(Guid id, int?p) { using (UnitOfWorkManager.NewUnitOfWork()) { var category = _categoryService.GetAllowedCategories(UsersRole).Where(x => x.Id == id).ToList(); var cate = _categoryService.Get(id); ViewBag.Category = cate; var settings = SettingsService.GetSettings(); // Set the page index var pageIndex = p ?? 1; // Get the topics var topics = _topicService.GetRecentTopics(pageIndex, 10, SiteConstants.Instance.ActiveTopicsListSize, category); // Get the Topic View Models var topicViewModels = ViewModelMapping.CreateTopicViewModels(topics, RoleService, UsersRole, LoggedOnReadOnlyUser, category, settings); // create the view model var viewModel = new ActiveTopicsViewModel { Topics = topicViewModels, PageIndex = pageIndex, TotalCount = topics.TotalCount, TotalPages = topics.TotalPages }; return(View(viewModel)); } }
public ActionResult LatestTopics(int?p) { using (UnitOfWorkManager.NewUnitOfWork()) { // Set the page index var pageIndex = p ?? 1; // Get the topics var topics = _topicService.GetRecentTopics(pageIndex, SettingsService.GetSettings().TopicsPerPage, SiteConstants.ActiveTopicsListSize); // Get the Topic View Models var topicViewModels = ViewModelMapping.CreateTopicViewModels(topics, RoleService, UsersRole, LoggedOnUser, SettingsService.GetSettings()); // create the view model var viewModel = new ActiveTopicsViewModel { Topics = topicViewModels, PageIndex = pageIndex, TotalCount = topics.TotalCount, TotalPages = topics.TotalPages }; return(PartialView(viewModel)); } }
public ActionResult LatestTopics(int? p) { using (UnitOfWorkManager.NewUnitOfWork()) { var allowedCategories = _categoryService.GetAllowedCategories(UsersRole); var settings = SettingsService.GetSettings(); // Set the page index var pageIndex = p ?? 1; // Get the topics var topics = _topicService.GetRecentTopics(pageIndex, settings.TopicsPerPage, SiteConstants.Instance.ActiveTopicsListSize, allowedCategories); // Get the Topic View Models var topicViewModels = ViewModelMapping.CreateTopicViewModels(topics, RoleService, UsersRole, LoggedOnReadOnlyUser, allowedCategories, settings); // create the view model var viewModel = new ActiveTopicsViewModel { Topics = topicViewModels, PageIndex = pageIndex, TotalCount = topics.TotalCount, TotalPages = topics.TotalPages }; return PartialView(viewModel); } }