/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="membershipRepository"> </param>
 /// <param name="settingsRepository"> </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="postRepository"></param>
 /// <param name="pollVoteRepository"></param>
 /// <param name="pollAnswerRepository"></param>
 /// <param name="pollRepository"></param>
 /// <param name="topicRepository"></param>
 /// <param name="favouriteRepository"></param>
 /// <param name="categoryService"></param>
 public MembershipService(IMembershipRepository membershipRepository, ISettingsRepository settingsRepository,
     IEmailService emailService, ILocalizationService localizationService, IActivityService activityService,
     IPrivateMessageService privateMessageService, IMembershipUserPointsService membershipUserPointsService,
     ITopicNotificationService topicNotificationService, IVoteService voteService, IBadgeService badgeService,
     ICategoryNotificationService categoryNotificationService, ILoggingService loggingService, IUploadedFileService uploadedFileService,
     IPostRepository postRepository, IPollVoteRepository pollVoteRepository, IPollAnswerRepository pollAnswerRepository,
     IPollRepository pollRepository, ITopicRepository topicRepository, IFavouriteRepository favouriteRepository,
     ICategoryService categoryService)
 {
     _membershipRepository = membershipRepository;
     _settingsRepository = settingsRepository;
     _emailService = emailService;
     _localizationService = localizationService;
     _activityService = activityService;
     _privateMessageService = privateMessageService;
     _membershipUserPointsService = membershipUserPointsService;
     _topicNotificationService = topicNotificationService;
     _voteService = voteService;
     _badgeService = badgeService;
     _categoryNotificationService = categoryNotificationService;
     _loggingService = loggingService;
     _uploadedFileService = uploadedFileService;
     _postRepository = postRepository;
     _pollVoteRepository = pollVoteRepository;
     _pollAnswerRepository = pollAnswerRepository;
     _pollRepository = pollRepository;
     _topicRepository = topicRepository;
     _favouriteRepository = favouriteRepository;
     _categoryService = categoryService;
 }
Beispiel #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;
 }
Beispiel #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="membershipRepository"> </param>
 /// <param name="settingsRepository"> </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="postRepository"></param>
 /// <param name="pollVoteRepository"></param>
 /// <param name="pollAnswerRepository"></param>
 /// <param name="pollRepository"></param>
 /// <param name="topicRepository"></param>
 /// <param name="favouriteRepository"></param>
 /// <param name="categoryService"></param>
 public MembershipService(IMembershipRepository membershipRepository, ISettingsRepository settingsRepository,
                          IEmailService emailService, ILocalizationService localizationService, IActivityService activityService,
                          IPrivateMessageService privateMessageService, IMembershipUserPointsService membershipUserPointsService,
                          ITopicNotificationService topicNotificationService, IVoteService voteService, IBadgeService badgeService,
                          ICategoryNotificationService categoryNotificationService, ILoggingService loggingService, IUploadedFileService uploadedFileService,
                          IPostRepository postRepository, IPollVoteRepository pollVoteRepository, IPollAnswerRepository pollAnswerRepository,
                          IPollRepository pollRepository, ITopicRepository topicRepository, IFavouriteRepository favouriteRepository,
                          ICategoryService categoryService)
 {
     _membershipRepository        = membershipRepository;
     _settingsRepository          = settingsRepository;
     _emailService                = emailService;
     _localizationService         = localizationService;
     _activityService             = activityService;
     _privateMessageService       = privateMessageService;
     _membershipUserPointsService = membershipUserPointsService;
     _topicNotificationService    = topicNotificationService;
     _voteService  = voteService;
     _badgeService = badgeService;
     _categoryNotificationService = categoryNotificationService;
     _loggingService       = loggingService;
     _uploadedFileService  = uploadedFileService;
     _postRepository       = postRepository;
     _pollVoteRepository   = pollVoteRepository;
     _pollAnswerRepository = pollAnswerRepository;
     _pollRepository       = pollRepository;
     _topicRepository      = topicRepository;
     _favouriteRepository  = favouriteRepository;
     _categoryService      = categoryService;
 }
Beispiel #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;
 }
Beispiel #5
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);
        }
Beispiel #6
0
 public TopicService(IMembershipUserPointsService membershipUserPointsService,
                     ISettingsService settingsService, ITopicRepository topicRepository, IPostRepository postRepository, ITopicNotificationService topicNotificationService)
 {
     _membershipUserPointsService = membershipUserPointsService;
     _settingsService             = settingsService;
     _topicRepository             = topicRepository;
     _postRepository           = postRepository;
     _topicNotificationService = topicNotificationService;
 }
Beispiel #7
0
 public TopicService(IMembershipUserPointsService membershipUserPointsService,
     ISettingsService settingsService, ITopicRepository topicRepository, IPostRepository postRepository, ITopicNotificationService topicNotificationService)
 {
     _membershipUserPointsService = membershipUserPointsService;
     _settingsService = settingsService;
     _topicRepository = topicRepository;
     _postRepository = postRepository;
     _topicNotificationService = topicNotificationService;
 }
 public void Init()
 {
     _api = Substitute.For<IMVCForumAPI>();
     _activityService = Substitute.For<IActivityService>();
     _privateMessageService = Substitute.For<IPrivateMessageService>();
     _membershipUserPointsService = Substitute.For<IMembershipUserPointsService>();
     _topicNotificationService = Substitute.For<ITopicNotificationService>();
     _voteService = Substitute.For<IVoteService>();
     _badgeService = Substitute.For<IBadgeService>();
     _categoryNotificationService = Substitute.For<ICategoryNotificationService>();
     _loggingService = Substitute.For<ILoggingService>();
 }
 public void Init()
 {
     _api                         = Substitute.For <IMVCForumAPI>();
     _activityService             = Substitute.For <IActivityService>();
     _privateMessageService       = Substitute.For <IPrivateMessageService>();
     _membershipUserPointsService = Substitute.For <IMembershipUserPointsService>();
     _topicNotificationService    = Substitute.For <ITopicNotificationService>();
     _voteService                 = Substitute.For <IVoteService>();
     _badgeService                = Substitute.For <IBadgeService>();
     _categoryNotificationService = Substitute.For <ICategoryNotificationService>();
     _loggingService              = Substitute.For <ILoggingService>();
 }
Beispiel #10
0
 public EmailController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService,
                        ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService,
                        ITopicNotificationService topicNotificationService, ICategoryNotificationService categoryNotificationService, ICategoryService categoryService,
                        ITopicService topicService, ITopicTagService topicTagService, ITagNotificationService tagNotificationService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
 {
     _topicNotificationService    = topicNotificationService;
     _categoryNotificationService = categoryNotificationService;
     _categoryService             = categoryService;
     _topicService           = topicService;
     _topicTagService        = topicTagService;
     _tagNotificationService = tagNotificationService;
 }
Beispiel #11
0
        public EmailController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, 
            ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService,
            ITopicNotificationService topicNotificationService, ICategoryNotificationService categoryNotificationService, ICategoryService categoryService,
            ITopicService topicService)
            : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
        {
            _topicNotificationService = topicNotificationService;
            _categoryNotificationService = categoryNotificationService;
            _categoryService = categoryService;
            _topicService = topicService;

            LoggedOnUser = UserIsAuthenticated ? MembershipService.GetUser(Username) : null;
        }
        public EmailController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService,
                               ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService,
                               ITopicNotificationService topicNotificationService, ICategoryNotificationService categoryNotificationService, ICategoryService categoryService,
                               ITopicService topicService)
            : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
        {
            _topicNotificationService    = topicNotificationService;
            _categoryNotificationService = categoryNotificationService;
            _categoryService             = categoryService;
            _topicService = topicService;

            LoggedOnUser = UserIsAuthenticated ? MembershipService.GetUser(Username) : null;
        }
Beispiel #13
0
 public EmailController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService, 
     ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService,
     ITopicNotificationService topicNotificationService, ICategoryNotificationService categoryNotificationService, ICategoryService categoryService,
     ITopicService topicService, ITopicTagService topicTagService, ITagNotificationService tagNotificationService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
 {
     _topicNotificationService = topicNotificationService;
     _categoryNotificationService = categoryNotificationService;
     _categoryService = categoryService;
     _topicService = topicService;
     _topicTagService = topicTagService;
     _tagNotificationService = tagNotificationService;
 }
 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;
 }
Beispiel #15
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;
 }
 /// <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;
 }
Beispiel #17
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;
 }
Beispiel #18
0
 public PostController(ILoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, IMembershipService membershipService,
                       ILocalizationService localizationService, IRoleService roleService, ITopicService topicService, IPostService postService,
                       ISettingsService settingsService, ICategoryService categoryService,
                       ITopicNotificationService topicNotificationService, IEmailService emailService, IReportService reportService, IBannedWordService bannedWordService, IVoteService voteService, IPostEditService postEditService)
     : base(loggingService, unitOfWorkManager, membershipService, localizationService, roleService, settingsService)
 {
     _topicService             = topicService;
     _postService              = postService;
     _categoryService          = categoryService;
     _topicNotificationService = topicNotificationService;
     _emailService             = emailService;
     _reportService            = reportService;
     _bannedWordService        = bannedWordService;
     _voteService              = voteService;
     _postEditService          = postEditService;
 }
Beispiel #19
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;
 }
 public EmailController(ILoggingService loggingService, IMembershipService membershipService,
                        ILocalizationService localizationService, IRoleService roleService, ISettingsService settingsService,
                        ITopicNotificationService topicNotificationService,
                        ICategoryNotificationService categoryNotificationService, ICategoryService categoryService,
                        ITopicService topicService, ITopicTagService topicTagService,
                        ITagNotificationService tagNotificationService, ICacheService cacheService, IMvcForumContext context)
     : base(loggingService, membershipService, localizationService, roleService,
            settingsService, cacheService, context)
 {
     _topicNotificationService    = topicNotificationService;
     _categoryNotificationService = categoryNotificationService;
     _categoryService             = categoryService;
     _topicService           = topicService;
     _topicTagService        = topicTagService;
     _tagNotificationService = tagNotificationService;
 }
Beispiel #21
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();
        }
        /// <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();
        }
        /// <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();
        }
Beispiel #24
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="membershipRepository"> </param>
 /// <param name="settingsRepository"> </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="api"> </param>
 /// <param name="loggingService"></param>
 public MembershipService(IMembershipRepository membershipRepository, ISettingsRepository settingsRepository,
                          IEmailService emailService, ILocalizationService localizationService, IActivityService activityService,
                          IPrivateMessageService privateMessageService, IMembershipUserPointsService membershipUserPointsService,
                          ITopicNotificationService topicNotificationService, IVoteService voteService, IBadgeService badgeService,
                          ICategoryNotificationService categoryNotificationService, IMVCForumAPI api, ILoggingService loggingService)
 {
     _membershipRepository        = membershipRepository;
     _settingsRepository          = settingsRepository;
     _emailService                = emailService;
     _localizationService         = localizationService;
     _activityService             = activityService;
     _privateMessageService       = privateMessageService;
     _membershipUserPointsService = membershipUserPointsService;
     _topicNotificationService    = topicNotificationService;
     _voteService  = voteService;
     _badgeService = badgeService;
     _categoryNotificationService = categoryNotificationService;
     _api            = api;
     _loggingService = loggingService;
 }
 /// <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="membershipRepository"> </param>
 /// <param name="settingsRepository"> </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="api"> </param>
 /// <param name="loggingService"></param>
 public MembershipService(IMembershipRepository membershipRepository, ISettingsRepository settingsRepository,
     IEmailService emailService, ILocalizationService localizationService, IActivityService activityService, 
     IPrivateMessageService privateMessageService, IMembershipUserPointsService membershipUserPointsService, 
     ITopicNotificationService topicNotificationService, IVoteService voteService, IBadgeService badgeService,
     ICategoryNotificationService categoryNotificationService, IMVCForumAPI api, ILoggingService loggingService)
 {
     _membershipRepository = membershipRepository;
     _settingsRepository = settingsRepository;
     _emailService = emailService;
     _localizationService = localizationService;
     _activityService = activityService;
     _privateMessageService = privateMessageService;
     _membershipUserPointsService = membershipUserPointsService;
     _topicNotificationService = topicNotificationService;
     _voteService = voteService;
     _badgeService = badgeService;
     _categoryNotificationService = categoryNotificationService;
     _api = api;
     _loggingService = loggingService;
 }
 public PostController(ILoggingService loggingService, IMembershipService membershipService,
                       ILocalizationService localizationService, IRoleService roleService, ITopicService topicService,
                       IPostService postService, ISettingsService settingsService, ICategoryService categoryService,
                       ITopicNotificationService topicNotificationService, IEmailService emailService,
                       IReportService reportService, IBannedWordService bannedWordService, IVoteService voteService,
                       IPostEditService postEditService, ICacheService cacheService, IMvcForumContext context, IActivityService activityService)
     : base(loggingService, membershipService, localizationService, roleService,
            settingsService, cacheService, context)
 {
     _topicService             = topicService;
     _postService              = postService;
     _categoryService          = categoryService;
     _topicNotificationService = topicNotificationService;
     _emailService             = emailService;
     _reportService            = reportService;
     _bannedWordService        = bannedWordService;
     _voteService              = voteService;
     _postEditService          = postEditService;
     _activityService          = activityService;
 }
 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;
 }
Beispiel #29
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;
 }
Beispiel #30
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();
        }
Beispiel #31
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();
        }
Beispiel #32
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="context"></param>
 /// <param name="settingsService"> </param>
 /// <param name="localizationService"> </param>
 /// <param name="activityService"> </param>
 /// <param name="cacheService"></param>
 /// <param name="voteService"></param>
 /// <param name="badgeService"></param>
 /// <param name="categoryNotificationService"></param>
 /// <param name="privateMessageService"></param>
 /// <param name="favouriteService"></param>
 /// <param name="topicNotificationService"></param>
 /// <param name="membershipUserPointsService"></param>
 /// <param name="pollVoteService"></param>
 /// <param name="topicService"></param>
 /// <param name="categoryService"></param>
 /// <param name="postService"></param>
 public MembershipService(IMvcForumContext context, ISettingsService settingsService, ILocalizationService localizationService,
                          IActivityService activityService, ICacheService cacheService, IVoteService voteService, IBadgeService badgeService,
                          ICategoryNotificationService categoryNotificationService, IPrivateMessageService privateMessageService,
                          IFavouriteService favouriteService, ITopicNotificationService topicNotificationService, IMembershipUserPointsService membershipUserPointsService,
                          IPollVoteService pollVoteService, ITopicService topicService, ICategoryService categoryService, IPostService postService)
 {
     _settingsService             = settingsService;
     _localizationService         = localizationService;
     _activityService             = activityService;
     _cacheService                = cacheService;
     _voteService                 = voteService;
     _badgeService                = badgeService;
     _categoryNotificationService = categoryNotificationService;
     _privateMessageService       = privateMessageService;
     _favouriteService            = favouriteService;
     _topicNotificationService    = topicNotificationService;
     _membershipUserPointsService = membershipUserPointsService;
     _pollVoteService             = pollVoteService;
     _topicService                = topicService;
     _categoryService             = categoryService;
     _postService                 = postService;
     _context = context;
 }
 public void Init()
 {
     _api = Substitute.For <IMVCForumAPI>();
     _topicNotificationService = Substitute.For <ITopicNotificationService>();
 }
Beispiel #34
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);
        }
 public void Init()
 {
     _api = Substitute.For<IMVCForumAPI>();
     _topicNotificationService = Substitute.For<ITopicNotificationService>();
 }