public SkillController(ISkillService skillService, IUserService userService, IMediaService mediaService, MediaSettings mediaSettings, IUserSkillService userSkillService, GeneralSettings generalSettings, IPermalinkService permalinkService, IFollowService followService, ILikeService likeService, ICommentService commentService, SkillSettings skillSettings)
 {
     _skillService     = skillService;
     _userService      = userService;
     _mediaService     = mediaService;
     _mediaSettings    = mediaSettings;
     _userSkillService = userSkillService;
     _generalSettings  = generalSettings;
     _permalinkService = permalinkService;
     _followService    = followService;
     _likeService      = likeService;
     _commentService   = commentService;
     _skillSettings    = skillSettings;
 }
Пример #2
0
 public SkillController(ISkillService skillService, ICustomerService userService, IMediaService mediaService, MediaSettings mediaSettings, IUserSkillService userSkillService, ICustomerFollowService followService, ICustomerLikeService likeService, ICustomerCommentService commentService, IWorkContext workContext, ICustomerProfileService customerProfileService, ICustomerProfileViewService customerProfileViewService, IPictureService pictureService, IUrlRecordService urlRecordService, IStoreContext storeContext, IWebHelper webHelper)
 {
     _skillService               = skillService;
     _userService                = userService;
     _mediaService               = mediaService;
     _mediaSettings              = mediaSettings;
     _userSkillService           = userSkillService;
     _followService              = followService;
     _likeService                = likeService;
     _commentService             = commentService;
     _workContext                = workContext;
     _customerProfileService     = customerProfileService;
     _customerProfileViewService = customerProfileViewService;
     _pictureService             = pictureService;
     _urlRecordService           = urlRecordService;
     _storeContext               = storeContext;
     _webHelper = webHelper;
 }
        public static SkillWithUsersModel ToSkillWithUsersModel(this Skill skill, IUserSkillService userSkillService, IMediaService mediaService,
                                                                MediaSettings mediaSettings, GeneralSettings generalSettings, SkillSettings skillSettings, IFollowService followService, ILikeService likeService, ICommentService commentService)
        {
            var currentUser = ApplicationContext.Current.CurrentUser;
            var model       = new SkillWithUsersModel()
            {
                Skill = skill.ToModel(),
                FeaturedMediaImageUrl = skill.FeaturedImageId > 0 ? mediaService.GetPictureUrl(skill.FeaturedImageId) : mediaSettings.DefaultSkillCoverUrl
            };

            var perPage = skillSettings.NumberOfUsersPerPageOnSinglePage;
            //by default we'll send data for 15 users. rest can be queried with paginated request
            //todo: make this thing configurable to set number of users to return with this response
            var userSkills = userSkillService.Get(x => x.SkillId == skill.Id, page: 1, count: perPage, earlyLoad: x => x.User).ToList();

            model.UserSkills =
                userSkills.Select(x => x.ToModel(mediaService, mediaSettings, generalSettings, false, true, true, false)).ToList();

            model.CurrentPage   = 1;
            model.UsersPerPage  = perPage;
            model.TotalUsers    = userSkillService.Count(x => x.SkillId == skill.Id);
            model.FollowerCount = followService.GetFollowerCount <Skill>(skill.Id);

            if (currentUser != null)
            {
                //does this user follow this skill?
                var userFollow = followService.GetCustomerFollow <Skill>(currentUser.Id, skill.Id);
                model.CanFollow    = currentUser.Id != skill.UserId;
                model.FollowStatus = userFollow == null ? 0 : 1;

                model.LikeStatus = likeService.GetCustomerLike <Skill>(currentUser.Id, skill.Id) == null ? 0 : 1;

                model.HasSkill = userSkills.Any(x => x.UserId == currentUser.Id);
            }


            model.TotalComments = commentService.GetCommentsCount(skill.Id, "skill");

            model.TotalLikes = likeService.GetLikeCount <Skill>(skill.Id);

            return(model);
        }
Пример #4
0
 public UserSkillController(IUserSkillService userSkillService)
 {
     _userSkillService = userSkillService;
 }
 public SkillController(ISkillService skillService, IWorkContext workContext, IUserSkillService userSkillService)
 {
     _skillService     = skillService;
     _workContext      = workContext;
     _userSkillService = userSkillService;
 }
Пример #6
0
 public UserSkillController(IUserSkillService service, IMapper mapper)
 {
     this.service = service;
     this.mapper  = mapper;
 }
Пример #7
0
 public UserService(IUserRoleService userRoleService, IRoleService roleService, IUserSkillService userSkillService)
 {
     _userRoleService  = userRoleService;
     _roleService      = roleService;
     _userSkillService = userSkillService;
 }
Пример #8
0
 public SkillService(IUserSkillService userSkillService)
 {
     _userSkillService = userSkillService;
 }
Пример #9
0
        public static SkillWithUsersModel ToSkillWithUsersModel(this Skill skill, IWorkContext workContext, IStoreContext storeContext, ICustomerService customerService, IUserSkillService userSkillService, IMediaService mediaService,
                                                                MediaSettings mediaSettings, ICustomerFollowService followService, ICustomerLikeService likeService, ICustomerCommentService commentService, ICustomerProfileService customerProfileService, ICustomerProfileViewService customerProfileViewService, IPictureService pictureService, UrlHelper urlHelper, IWebHelper webHelper)
        {
            var currentUser = workContext.CurrentCustomer;
            var model       = new SkillWithUsersModel()
            {
                Skill = skill.ToModel(workContext),
                FeaturedMediaImageUrl = skill.FeaturedImageId > 0 ? mediaService.GetPictureUrl(skill.FeaturedImageId) : ""
            };

            var perPage = 15;
            //by default we'll send data for 15 users. rest can be queried with paginated request
            //todo: make this thing configurable to set number of users to return with this response
            var userSkills = userSkillService.Get(x => x.SkillId == skill.Id).ToList();

            model.UserSkills =
                userSkills.OrderBy(x => x.Id).Take(perPage).Select(
                    x =>
                    x.ToModel(mediaService, mediaSettings, workContext, storeContext, customerService,
                              customerProfileViewService, customerProfileService, pictureService, urlHelper, webHelper, false, true, true, false)).ToList();

            model.CurrentPage   = 1;
            model.UsersPerPage  = perPage;
            model.TotalUsers    = userSkillService.Count(x => x.SkillId == skill.Id);
            model.FollowerCount = followService.GetFollowerCount <Skill>(skill.Id);

            //does this user follow this skill?
            var userFollow = followService.GetCustomerFollow <Skill>(currentUser.Id, skill.Id);

            model.CanFollow     = true;
            model.FollowStatus  = userFollow == null ? 0 : 1;
            model.HasSkill      = userSkills.Any(x => x.UserId == currentUser.Id);
            model.TotalComments = commentService.GetCommentsCount(skill.Id, "skill");
            model.LikeStatus    = likeService.GetCustomerLike <Skill>(currentUser.Id, skill.Id) == null ? 0 : 1;
            model.TotalLikes    = likeService.GetLikeCount <Skill>(skill.Id);
            return(model);
        }
Пример #10
0
 public UserSkillController(IUserSkillService userSkillService, IMediator mediator)
 {
     _userSkillService = userSkillService;
     _mediator = mediator;
 }