Exemplo n.º 1
0
        public static List <TopicViewModel> CreateTopicViewModels(List <Topic> topics,
                                                                  IRoleService roleService,
                                                                  MembershipRole usersRole,
                                                                  MembershipUser loggedOnUser,
                                                                  List <Category> allowedCategories,
                                                                  Settings settings,
                                                                  IPostService postService,
                                                                  ITopicNotificationService topicNotificationService,
                                                                  IPollAnswerService pollAnswerService,
                                                                  IVoteService voteService,
                                                                  IFavouriteService favouriteService)
        {
            // Get all topic Ids
            var topicIds = topics.Select(x => x.Id).ToList();

            // Gets posts for topics
            var posts        = postService.GetPostsByTopics(topicIds, allowedCategories);
            var groupedPosts = posts.ToLookup(x => x.Topic.Id);

            // Get all permissions
            var permissions = GetPermissionsForTopics(topics, roleService, usersRole);

            // Create the view models
            var viewModels = new List <TopicViewModel>();

            foreach (var topic in topics)
            {
                var id         = topic.Id;
                var permission = permissions[topic.Category];
                var topicPosts = groupedPosts.Contains(id) ? groupedPosts[id].ToList() : new List <Post>();
                viewModels.Add(CreateTopicViewModel(topic, permission, topicPosts, null, null, null, null, loggedOnUser,
                                                    settings, topicNotificationService, pollAnswerService, voteService, favouriteService));
            }
            return(viewModels);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"></param>
 /// <param name="settingsService"> </param>
 /// <param name="emailService"> </param>
 /// <param name="localizationService"> </param>
 /// <param name="activityService"> </param>
 /// <param name="privateMessageService"> </param>
 /// <param name="membershipUserPointsService"> </param>
 /// <param name="topicNotificationService"> </param>
 /// <param name="voteService"> </param>
 /// <param name="badgeService"> </param>
 /// <param name="categoryNotificationService"> </param>
 /// <param name="loggingService"></param>
 /// <param name="uploadedFileService"></param>
 /// <param name="postService"></param>
 /// <param name="pollVoteService"></param>
 /// <param name="pollAnswerService"></param>
 /// <param name="pollService"></param>
 /// <param name="topicService"></param>
 /// <param name="favouriteService"></param>
 /// <param name="categoryService"></param>
 public MembershipService(IMVCForumContext context, ISettingsService settingsService,
     IEmailService emailService, ILocalizationService localizationService, IActivityService activityService,
     IPrivateMessageService privateMessageService, IMembershipUserPointsService membershipUserPointsService,
     ITopicNotificationService topicNotificationService, IVoteService voteService, IBadgeService badgeService,
     ICategoryNotificationService categoryNotificationService, ILoggingService loggingService, IUploadedFileService uploadedFileService,
     IPostService postService, IPollVoteService pollVoteService, IPollAnswerService pollAnswerService,
     IPollService pollService, ITopicService topicService, IFavouriteService favouriteService, 
     ICategoryService categoryService, IPostEditService postEditService)
 {
     _settingsService = settingsService;
     _emailService = emailService;
     _localizationService = localizationService;
     _activityService = activityService;
     _privateMessageService = privateMessageService;
     _membershipUserPointsService = membershipUserPointsService;
     _topicNotificationService = topicNotificationService;
     _voteService = voteService;
     _badgeService = badgeService;
     _categoryNotificationService = categoryNotificationService;
     _loggingService = loggingService;
     _uploadedFileService = uploadedFileService;
     _postService = postService;
     _pollVoteService = pollVoteService;
     _pollAnswerService = pollAnswerService;
     _pollService = pollService;
     _topicService = topicService;
     _favouriteService = favouriteService;
     _categoryService = categoryService;
     _postEditService = postEditService;
     _context = context as MVCForumContext;
 }
 /// <summary>
 /// ctor.
 /// </summary>
 /// <param name="mapper"></param>
 /// <param name="logger"></param>
 /// <param name="pollAnswerService"></param>
 /// <param name="pollQuestionService"></param>
 public PollAnswerController(IMapper mapper, ILogger <PollAnswer> logger,
                             IPollAnswerService pollAnswerService,
                             IPollQuestionService pollQuestionService) : base(mapper, logger)
 {
     _pollAnswerService   = pollAnswerService;
     _pollQuestionService = pollQuestionService;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"></param>
 /// <param name="settingsService"> </param>
 /// <param name="emailService"> </param>
 /// <param name="localizationService"> </param>
 /// <param name="activityService"> </param>
 /// <param name="privateMessageService"> </param>
 /// <param name="membershipUserPointsService"> </param>
 /// <param name="topicNotificationService"> </param>
 /// <param name="voteService"> </param>
 /// <param name="badgeService"> </param>
 /// <param name="categoryNotificationService"> </param>
 /// <param name="loggingService"></param>
 /// <param name="uploadedFileService"></param>
 /// <param name="postService"></param>
 /// <param name="pollVoteService"></param>
 /// <param name="pollAnswerService"></param>
 /// <param name="pollService"></param>
 /// <param name="topicService"></param>
 /// <param name="favouriteService"></param>
 /// <param name="categoryService"></param>
 public MembershipService(IMVCForumContext context, ISettingsService settingsService,
                          IEmailService emailService, ILocalizationService localizationService, IActivityService activityService,
                          IPrivateMessageService privateMessageService, IMembershipUserPointsService membershipUserPointsService,
                          ITopicNotificationService topicNotificationService, IVoteService voteService, IBadgeService badgeService,
                          ICategoryNotificationService categoryNotificationService, ILoggingService loggingService, IUploadedFileService uploadedFileService,
                          IPostService postService, IPollVoteService pollVoteService, IPollAnswerService pollAnswerService,
                          IPollService pollService, ITopicService topicService, IFavouriteService favouriteService,
                          ICategoryService categoryService, IPostEditService postEditService)
 {
     _settingsService             = settingsService;
     _emailService                = emailService;
     _localizationService         = localizationService;
     _activityService             = activityService;
     _privateMessageService       = privateMessageService;
     _membershipUserPointsService = membershipUserPointsService;
     _topicNotificationService    = topicNotificationService;
     _voteService  = voteService;
     _badgeService = badgeService;
     _categoryNotificationService = categoryNotificationService;
     _loggingService      = loggingService;
     _uploadedFileService = uploadedFileService;
     _postService         = postService;
     _pollVoteService     = pollVoteService;
     _pollAnswerService   = pollAnswerService;
     _pollService         = pollService;
     _topicService        = topicService;
     _favouriteService    = favouriteService;
     _categoryService     = categoryService;
     _postEditService     = postEditService;
     _context             = context as MVCForumContext;
 }
Exemplo n.º 5
0
 public PollController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService,
                       ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService, IPollService pollService, IPollVoteService pollVoteService,
                       IPollAnswerService pollAnswerService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
 {
     _pollService       = pollService;
     _pollAnswerService = pollAnswerService;
     _pollVoteService   = pollVoteService;
 }
Exemplo n.º 6
0
 public PollController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, 
     ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService, IPollService pollService, IPollVoteService pollVoteService, 
     IPollAnswerService pollAnswerService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
 {
     _pollService = pollService;
     _pollAnswerService = pollAnswerService;
     _pollVoteService = pollVoteService;
 }
 public PollPreviewService(
     IMapper mapper,
     IPollService pollService,
     IPollAnswerService pollAnswerService)
 {
     _mapper            = mapper;
     _pollService       = pollService;
     _pollAnswerService = pollAnswerService;
 }
Exemplo n.º 8
0
 public PollController(ILoggingService loggingService, IMembershipService membershipService,
                       ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService,
                       IPollService pollService, IPollVoteService pollVoteService, IPollAnswerService pollAnswerService,
                       ICacheService cacheService, IMvcForumContext context)
     : base(loggingService, membershipService, localizationService, roleService,
            settingsService, cacheService, context)
 {
     _pollService       = pollService;
     _pollAnswerService = pollAnswerService;
     _pollVoteService   = pollVoteService;
 }
Exemplo n.º 9
0
        public PollController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, 
            ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService, IPollService pollService, IPollVoteService pollVoteService, 
            IPollAnswerService pollAnswerService)
            : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
        {
            _pollService = pollService;
            _pollAnswerService = pollAnswerService;
            _pollVoteService = pollVoteService;

            LoggedOnUser = UserIsAuthenticated ? MembershipService.GetUser(Username) : null;
        }
Exemplo n.º 10
0
        public PollController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService,
                              ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService, IPollService pollService, IPollVoteService pollVoteService,
                              IPollAnswerService pollAnswerService)
            : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
        {
            _pollService       = pollService;
            _pollAnswerService = pollAnswerService;
            _pollVoteService   = pollVoteService;


            LoggedOnUser = UserIsAuthenticated ? MembershipService.GetUser(Username) : null;
        }
Exemplo n.º 11
0
 public MembersController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, ILocalizationService localizationService,
     IRoleService roleService, ISettingsService settingsService, IPostService postService, IReportService reportService, IEmailService emailService, IPrivateMessageService privateMessageService, IBannedEmailService bannedEmailService, IBannedWordService bannedWordService, ITopicNotificationService topicNotificationService, IPollAnswerService pollAnswerService, IVoteService voteService, ICategoryService categoryService, ITopicService topicService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
 {
     _postService = postService;
     _reportService = reportService;
     _emailService = emailService;
     _privateMessageService = privateMessageService;
     _bannedEmailService = bannedEmailService;
     _bannedWordService = bannedWordService;
     _categoryService = categoryService;
     _topicService = topicService;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="loggingService"> </param>
 /// <param name="unitOfWorkManager"> </param>
 /// <param name="membershipService"></param>
 /// <param name="localizationService"></param>
 /// <param name="roleService"></param>
 /// <param name="categoryService"></param>
 /// <param name="settingsService"> </param>
 /// <param name="topicService"> </param>
 /// <param name="categoryNotificationService"> </param>
 public CategoryController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager,
     IMembershipService membershipService,
     ILocalizationService localizationService,
     IRoleService roleService,
     ICategoryService categoryService,
     ISettingsService settingsService, ITopicService topicService, ICategoryNotificationService categoryNotificationService, IPollAnswerService pollAnswerService, ITopicNotificationService topicNotificationService, IVoteService voteService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
 {
     _categoryService = categoryService;
     _topicService = topicService;
     _categoryNotificationService = categoryNotificationService;
     _pollAnswerService = pollAnswerService;
     _topicNotificationService = topicNotificationService;
     _voteService = voteService;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="loggingService"> </param>
 /// <param name="unitOfWorkManager"> </param>
 /// <param name="membershipService"></param>
 /// <param name="localizationService"></param>
 /// <param name="roleService"></param>
 /// <param name="categoryService"></param>
 /// <param name="settingsService"> </param>
 /// <param name="topicService"> </param>
 /// <param name="categoryNotificationService"> </param>
 public CategoryController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager,
                           IMembershipService membershipService,
                           ILocalizationService localizationService,
                           IRoleService roleService,
                           ICategoryService categoryService,
                           ISettingsService settingsService, ITopicService topicService, ICategoryNotificationService categoryNotificationService, IPollAnswerService pollAnswerService, ITopicNotificationService topicNotificationService, IVoteService voteService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
 {
     _categoryService             = categoryService;
     _topicService                = topicService;
     _categoryNotificationService = categoryNotificationService;
     _pollAnswerService           = pollAnswerService;
     _topicNotificationService    = topicNotificationService;
     _voteService = voteService;
 }
Exemplo n.º 14
0
 public SiteApiController(INewsService newsService, ILocationService locationService,
                          IPollAnswerService pollAnswerService, IPollService pollService, ILinkTrackerService linkTrackerService,
                          IFormService formService, IContactService contactService, IDocumentService documentService,
                          IProtectedDocumentLogService protectedDocumentLogService, ISubscriptionService subscriptionService)
 {
     _newsService                 = newsService;
     _locationService             = locationService;
     _pollAnswerService           = pollAnswerService;
     _pollService                 = pollService;
     _linkTrackerService          = linkTrackerService;
     _formService                 = formService;
     _contactService              = contactService;
     _documentService             = documentService;
     _protectedDocumentLogService = protectedDocumentLogService;
     _subscriptionService         = subscriptionService;
 }
Exemplo n.º 15
0
 public TopicService(IMVCForumContext context, IMembershipUserPointsService membershipUserPointsService,
                     ISettingsService settingsService, ITopicNotificationService topicNotificationService,
                     IFavouriteService favouriteService,
                     IPostService postService, IRoleService roleService, IPollService pollService, IPollAnswerService pollAnswerService, ICacheService cacheService)
 {
     _membershipUserPointsService = membershipUserPointsService;
     _settingsService             = settingsService;
     _topicNotificationService    = topicNotificationService;
     _favouriteService            = favouriteService;
     _postService       = postService;
     _roleService       = roleService;
     _pollService       = pollService;
     _pollAnswerService = pollAnswerService;
     _cacheService      = cacheService;
     _context           = context as MVCForumContext;
 }
Exemplo n.º 16
0
 public TopicService(IMVCForumContext context, IMembershipUserPointsService membershipUserPointsService,
     ISettingsService settingsService, ITopicNotificationService topicNotificationService,
     IFavouriteService favouriteService,
     IPostService postService, IRoleService roleService, IPollService pollService, IPollAnswerService pollAnswerService, ICacheService cacheService)
 {
     _membershipUserPointsService = membershipUserPointsService;
     _settingsService = settingsService;
     _topicNotificationService = topicNotificationService;
     _favouriteService = favouriteService;
     _postService = postService;
     _roleService = roleService;
     _pollService = pollService;
     _pollAnswerService = pollAnswerService;
     _cacheService = cacheService;
     _context = context as MVCForumContext;
 }
Exemplo n.º 17
0
        public MembersController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, ILocalizationService localizationService,
            IRoleService roleService, ISettingsService settingsService, IPostService postService, IReportService reportService, IEmailService emailService, IPrivateMessageService privateMessageService, IBannedEmailService bannedEmailService, IBannedWordService bannedWordService, ITopicNotificationService topicNotificationService, IPollAnswerService pollAnswerService, IVoteService voteService)
            : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
        {
            _postService = postService;
            _reportService = reportService;
            _emailService = emailService;
            _privateMessageService = privateMessageService;
            _bannedEmailService = bannedEmailService;
            _bannedWordService = bannedWordService;
            _topicNotificationService = topicNotificationService;
            _pollAnswerService = pollAnswerService;
            _voteService = voteService;

            LoggedOnUser = UserIsAuthenticated ? MembershipService.GetUser(Username) : null;
            UsersRole = LoggedOnUser == null ? RoleService.GetRole(AppConstants.GuestRoleName) : LoggedOnUser.Roles.FirstOrDefault();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="loggingService"> </param>
        /// <param name="unitOfWorkManager"> </param>
        /// <param name="membershipService"></param>
        /// <param name="localizationService"></param>
        /// <param name="roleService"></param>
        /// <param name="categoryService"></param>
        /// <param name="settingsService"> </param>
        /// <param name="topicService"> </param>
        /// <param name="categoryNotificationService"> </param>
        public CategoryController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager,
            IMembershipService membershipService,
            ILocalizationService localizationService,
            IRoleService roleService,
            ICategoryService categoryService,
            ISettingsService settingsService, ITopicService topicService, ICategoryNotificationService categoryNotificationService, IPollAnswerService pollAnswerService, ITopicNotificationService topicNotificationService, IVoteService voteService)
            : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
        {
            _categoryService = categoryService;
            _topicService = topicService;
            _categoryNotificationService = categoryNotificationService;
            _pollAnswerService = pollAnswerService;
            _topicNotificationService = topicNotificationService;
            _voteService = voteService;

            LoggedOnUser = UserIsAuthenticated ? MembershipService.GetUser(Username) : null;
            UsersRole = LoggedOnUser == null ? RoleService.GetRole(AppConstants.GuestRoleName) : LoggedOnUser.Roles.FirstOrDefault();
        }
Exemplo n.º 19
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="loggingService"> </param>
        /// <param name="unitOfWorkManager"> </param>
        /// <param name="membershipService"></param>
        /// <param name="localizationService"></param>
        /// <param name="roleService"></param>
        /// <param name="categoryService"></param>
        /// <param name="settingsService"> </param>
        /// <param name="topicService"> </param>
        /// <param name="categoryNotificationService"> </param>
        public CategoryController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager,
                                  IMembershipService membershipService,
                                  ILocalizationService localizationService,
                                  IRoleService roleService,
                                  ICategoryService categoryService,
                                  ISettingsService settingsService, ITopicService topicService, ICategoryNotificationService categoryNotificationService, IPollAnswerService pollAnswerService, ITopicNotificationService topicNotificationService, IVoteService voteService)
            : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
        {
            _categoryService             = categoryService;
            _topicService                = topicService;
            _categoryNotificationService = categoryNotificationService;
            _pollAnswerService           = pollAnswerService;
            _topicNotificationService    = topicNotificationService;
            _voteService = voteService;

            LoggedOnUser = UserIsAuthenticated ? MembershipService.GetUser(Username) : null;
            UsersRole    = LoggedOnUser == null?RoleService.GetRole(AppConstants.GuestRoleName) : LoggedOnUser.Roles.FirstOrDefault();
        }
Exemplo n.º 20
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="unitOfWorkManager"> </param>
 /// <param name="membershipService"></param>
 /// <param name="localizationService"> </param>
 /// <param name="roleService"> </param>
 /// <param name="settingsService"> </param>
 /// <param name="loggingService"> </param>
 /// <param name="postService"> </param>
 /// <param name="topicService"> </param>
 /// <param name="membershipUserPointsService"> </param>
 /// <param name="activityService"> </param>
 /// <param name="pollService"> </param>
 /// <param name="pollVoteService"> </param>
 /// <param name="pollAnswerService"> </param>
 /// <param name="uploadedFileService"></param>
 public AccountController(ILoggingService loggingService,
     IUnitOfWorkManager unitOfWorkManager,
     IMembershipService membershipService,
     ILocalizationService localizationService,
     IRoleService roleService,
     ISettingsService settingsService, IPostService postService, ITopicService topicService, IMembershipUserPointsService membershipUserPointsService, 
     IActivityService activityService, IPollService pollService, IPollVoteService pollVoteService, IPollAnswerService pollAnswerService, IUploadedFileService uploadedFileService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, settingsService)
 {
     _activityService = activityService;
     _roleService = roleService;
     _postService = postService;
     _topicService = topicService;
     _membershipUserPointsService = membershipUserPointsService;
     _pollService = pollService;
     _pollVoteService = pollVoteService;
     _pollAnswerService = pollAnswerService;
     _uploadedFileService = uploadedFileService;
 }
Exemplo n.º 21
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="unitOfWorkManager"> </param>
 /// <param name="membershipService"></param>
 /// <param name="localizationService"> </param>
 /// <param name="roleService"> </param>
 /// <param name="settingsService"> </param>
 /// <param name="loggingService"> </param>
 /// <param name="postService"> </param>
 /// <param name="topicService"> </param>
 /// <param name="membershipUserPointsService"> </param>
 /// <param name="activityService"> </param>
 /// <param name="pollService"> </param>
 /// <param name="pollVoteService"> </param>
 /// <param name="pollAnswerService"> </param>
 /// <param name="uploadedFileService"></param>
 public AccountController(ILoggingService loggingService,
                          IUnitOfWorkManager unitOfWorkManager,
                          IMembershipService membershipService,
                          ILocalizationService localizationService,
                          IRoleService roleService,
                          ISettingsService settingsService, IPostService postService, ITopicService topicService, IMembershipUserPointsService membershipUserPointsService,
                          IActivityService activityService, IPollService pollService, IPollVoteService pollVoteService, IPollAnswerService pollAnswerService, IUploadedFileService uploadedFileService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, settingsService)
 {
     _activityService             = activityService;
     _roleService                 = roleService;
     _postService                 = postService;
     _topicService                = topicService;
     _membershipUserPointsService = membershipUserPointsService;
     _pollService                 = pollService;
     _pollVoteService             = pollVoteService;
     _pollAnswerService           = pollAnswerService;
     _uploadedFileService         = uploadedFileService;
 }
Exemplo n.º 22
0
 public PostController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService,
                       ILocalizationService localizationService, IRoleService roleService, ITopicService topicService, IPostService postService,
                       ISettingsService settingsService, ICategoryService categoryService, ITopicTagService topicTagService,
                       ITopicNotificationService topicNotificationService, IEmailService emailService, IReportService reportService, IPollAnswerService pollAnswerService,
                       IPollService pollService, IBannedWordService bannedWordService, IMembershipUserPointsService membershipUserPointsService, IVoteService voteService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
 {
     _topicService                = topicService;
     _postService                 = postService;
     _categoryService             = categoryService;
     _topicTagService             = topicTagService;
     _topicNotificationService    = topicNotificationService;
     _emailService                = emailService;
     _reportService               = reportService;
     _pollAnswerService           = pollAnswerService;
     _pollService                 = pollService;
     _bannedWordService           = bannedWordService;
     _membershipUserPointsService = membershipUserPointsService;
     _voteService                 = voteService;
 }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="loggingService"> </param>
 /// <param name="membershipService"></param>
 /// <param name="localizationService"></param>
 /// <param name="roleService"></param>
 /// <param name="categoryService"></param>
 /// <param name="settingsService"> </param>
 /// <param name="topicService"> </param>
 /// <param name="categoryNotificationService"> </param>
 /// <param name="cacheService"></param>
 /// <param name="postService"></param>
 /// <param name="topicNotificationService"></param>
 /// <param name="pollAnswerService"></param>
 /// <param name="voteService"></param>
 /// <param name="favouriteService"></param>
 /// <param name="context"></param>
 public CategoryController(ILoggingService loggingService, IMembershipService membershipService,
                           ILocalizationService localizationService, IRoleService roleService, ICategoryService categoryService,
                           ISettingsService settingsService, ITopicService topicService,
                           ICategoryNotificationService categoryNotificationService, ICacheService cacheService,
                           IPostService postService, ITopicNotificationService topicNotificationService,
                           IPollAnswerService pollAnswerService, IVoteService voteService, IFavouriteService favouriteService,
                           IMvcForumContext context)
     : base(loggingService, membershipService, localizationService, roleService,
            settingsService, cacheService, context)
 {
     _categoryService             = categoryService;
     _topicService                = topicService;
     _categoryNotificationService = categoryNotificationService;
     _topicNotificationService    = topicNotificationService;
     _pollAnswerService           = pollAnswerService;
     _voteService      = voteService;
     _favouriteService = favouriteService;
     _postService      = postService;
     _roleService      = roleService;
 }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="context"></param>
 /// <param name="membershipService"></param>
 /// <param name="localizationService"> </param>
 /// <param name="roleService"> </param>
 /// <param name="settingsService"> </param>
 /// <param name="loggingService"> </param>
 /// <param name="postService"> </param>
 /// <param name="topicService"> </param>
 /// <param name="membershipUserPointsService"> </param>
 /// <param name="activityService"> </param>
 /// <param name="pollService"> </param>
 /// <param name="pollVoteService"> </param>
 /// <param name="pollAnswerService"> </param>
 /// <param name="uploadedFileService"></param>
 public AccountController(ILoggingService loggingService, IMvcForumContext context,
                          IMembershipService membershipService,
                          ILocalizationService localizationService,
                          IRoleService roleService,
                          ISettingsService settingsService, IPostService postService, ITopicService topicService,
                          IMembershipUserPointsService membershipUserPointsService,
                          IActivityService activityService, IPollService pollService, IPollVoteService pollVoteService,
                          IPollAnswerService pollAnswerService, IUploadedFileService uploadedFileService)
     : base(loggingService, membershipService, localizationService, settingsService, context)
 {
     ActivityService = activityService;
     _roleService    = roleService;
     _postService    = postService;
     _topicService   = topicService;
     _membershipUserPointsService = membershipUserPointsService;
     _pollService         = pollService;
     _pollVoteService     = pollVoteService;
     _pollAnswerService   = pollAnswerService;
     _uploadedFileService = uploadedFileService;
 }
Exemplo n.º 25
0
 public FavouriteController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, IRoleService roleService, ITopicService topicService, IPostService postService,
     ICategoryService categoryService, ILocalizationService localizationService, ISettingsService settingsService, ITopicTagService topicTagService, IMembershipUserPointsService membershipUserPointsService,
     ICategoryNotificationService categoryNotificationService, IEmailService emailService, ITopicNotificationService topicNotificationService, IPollService pollService,
     IPollAnswerService pollAnswerService, IBannedWordService bannedWordService, IVoteService voteService, IFavouriteService favouriteService, IBadgeService badgeService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
 {
     _topicService = topicService;
     _postService = postService;
     _categoryService = categoryService;
     _topicTagService = topicTagService;
     _membershipUserPointsService = membershipUserPointsService;
     _categoryNotificationService = categoryNotificationService;
     _emailService = emailService;
     _topicNotificationService = topicNotificationService;
     _pollService = pollService;
     _pollAnswerService = pollAnswerService;
     _bannedWordService = bannedWordService;
     _voteService = voteService;
     _favouriteService = favouriteService;
     _badgeService = badgeService;
 }
Exemplo n.º 26
0
        public TopicController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, IRoleService roleService, ITopicService topicService, IPostService postService,
            ICategoryService categoryService, ILocalizationService localizationService, ISettingsService settingsService, ITopicTagService topicTagService, IMembershipUserPointsService membershipUserPointsService,
            ICategoryNotificationService categoryNotificationService, IEmailService emailService, ITopicNotificationService topicNotificationService, ILuceneService luceneService, IPollService pollService,
            IPollAnswerService pollAnswerService, IBannedWordService bannedWordService)
            : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
        {
            _topicService = topicService;
            _postService = postService;
            _categoryService = categoryService;
            _topicTagService = topicTagService;
            _membershipUserPointsService = membershipUserPointsService;
            _categoryNotificationService = categoryNotificationService;
            _emailService = emailService;
            _topicNotificationService = topicNotificationService;
            _luceneService = luceneService;
            _pollService = pollService;
            _pollAnswerService = pollAnswerService;
            _bannedWordService = bannedWordService;

            LoggedOnUser = UserIsAuthenticated ? MembershipService.GetUser(Username) : null;
            UsersRole = LoggedOnUser == null ? RoleService.GetRole(AppConstants.GuestRoleName) : LoggedOnUser.Roles.FirstOrDefault();
        }
Exemplo n.º 27
0
        public TopicController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, IRoleService roleService, ITopicService topicService, IPostService postService,
                               ICategoryService categoryService, ILocalizationService localizationService, ISettingsService settingsService, ITopicTagService topicTagService, IMembershipUserPointsService membershipUserPointsService,
                               ICategoryNotificationService categoryNotificationService, IEmailService emailService, ITopicNotificationService topicNotificationService, ILuceneService luceneService, IPollService pollService,
                               IPollAnswerService pollAnswerService, IBannedWordService bannedWordService)
            : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
        {
            _topicService                = topicService;
            _postService                 = postService;
            _categoryService             = categoryService;
            _topicTagService             = topicTagService;
            _membershipUserPointsService = membershipUserPointsService;
            _categoryNotificationService = categoryNotificationService;
            _emailService                = emailService;
            _topicNotificationService    = topicNotificationService;
            _luceneService               = luceneService;
            _pollService                 = pollService;
            _pollAnswerService           = pollAnswerService;
            _bannedWordService           = bannedWordService;

            LoggedOnUser = UserIsAuthenticated ? MembershipService.GetUser(Username) : null;
            UsersRole    = LoggedOnUser == null?RoleService.GetRole(AppConstants.GuestRoleName) : LoggedOnUser.Roles.FirstOrDefault();
        }
 public PollAnswerController(IPollAnswerService pollAnswerService)
 {
     _pollAnswerService = pollAnswerService;
 }
Exemplo n.º 29
0
        public static TopicViewModel CreateTopicViewModel(Topic topic,
                                                          PermissionSet permission,
                                                          List <Post> posts,
                                                          Post starterPost,
                                                          int?pageIndex,
                                                          int?totalCount,
                                                          int?totalPages,
                                                          MembershipUser loggedOnUser,
                                                          Settings settings,
                                                          ITopicNotificationService topicNotificationService,
                                                          IPollAnswerService pollAnswerService,
                                                          IVoteService voteService,
                                                          IFavouriteService favouriteService,
                                                          bool getExtendedData = false)
        {
            var userIsAuthenticated = loggedOnUser != null;

            // Check for online status
            var date = DateTime.UtcNow.AddMinutes(-AppConstants.TimeSpanInMinutesToShowMembers);

            var viewModel = new TopicViewModel
            {
                Permissions       = permission,
                Topic             = topic,
                Views             = topic.Views,
                DisablePosting    = loggedOnUser != null && loggedOnUser.DisablePosting == true,
                PageIndex         = pageIndex,
                TotalCount        = totalCount,
                TotalPages        = totalPages,
                LastPostPermaLink = string.Concat(topic.NiceUrl, "?", AppConstants.PostOrderBy, "=",
                                                  AppConstants.AllPosts, "#comment-", topic.LastPost.Id),
                MemberIsOnline = topic.User.LastActivityDate > date
            };

            if (starterPost == null)
            {
                starterPost = posts.FirstOrDefault(x => x.IsTopicStarter);
            }

            // Get votes for all posts
            var postIds = posts.Select(x => x.Id).ToList();

            postIds.Add(starterPost.Id);

            // Get all votes by post
            var votes = voteService.GetVotesByPosts(postIds);

            // Get all favourites for this user
            var allFavourites = favouriteService.GetByTopic(topic.Id);

            // Map the votes
            var startPostVotes = votes.Where(x => x.Post.Id == starterPost.Id).ToList();
            var startPostFavs  = allFavourites.Where(x => x.Post.Id == starterPost.Id).ToList();

            // Create the starter post viewmodel
            viewModel.StarterPost = CreatePostViewModel(starterPost, startPostVotes, permission, topic, loggedOnUser,
                                                        settings, startPostFavs);

            // Map data from the starter post viewmodel
            viewModel.VotesUp   = startPostVotes.Count(x => x.Amount > 0);
            viewModel.VotesDown = startPostVotes.Count(x => x.Amount < 0);
            viewModel.Answers   = totalCount != null ? (int)totalCount : posts.Count() - 1;

            // Create the ALL POSTS view models
            viewModel.Posts =
                CreatePostViewModels(posts, votes, permission, topic, loggedOnUser, settings, allFavourites);

            // ########### Full topic need everything

            if (getExtendedData)
            {
                // See if the user has subscribed to this topic or not
                var isSubscribed = userIsAuthenticated &&
                                   topicNotificationService.GetByUserAndTopic(loggedOnUser, topic).Any();
                viewModel.IsSubscribed = isSubscribed;

                // See if the topic has a poll, and if so see if this user viewing has already voted
                if (topic.Poll != null)
                {
                    // There is a poll and a user
                    // see if the user has voted or not

                    viewModel.Poll = new PollViewModel
                    {
                        Poll = topic.Poll,
                        UserAllowedToVote = permission[SiteConstants.Instance.PermissionVoteInPolls].IsTicked
                    };

                    var answers = pollAnswerService.GetAllPollAnswersByPoll(topic.Poll);
                    if (answers.Any())
                    {
                        var pollvotes = answers.SelectMany(x => x.PollVotes).ToList();
                        if (userIsAuthenticated)
                        {
                            viewModel.Poll.UserHasAlreadyVoted = pollvotes.Count(x => x.User.Id == loggedOnUser.Id) > 0;
                        }
                        viewModel.Poll.TotalVotesInPoll = pollvotes.Count();
                    }
                }
            }

            return(viewModel);
        }
Exemplo n.º 30
0
 public PollResultResolver()
 {
     _widgetTemplateService    = HostContainer.GetInstance <IWidgetTemplateService>();
     _pollAnswerService        = HostContainer.GetInstance <IPollAnswerService>();
     _localizedResourceService = HostContainer.GetInstance <IEzCMSLocalizedResourceService>();
 }