protected override Entities.PagePromotion MapInternal(IPublishedContent content) { var pagePromotion = content.Map <Entities.PagePromotion>(); var config = PagePromotionHelper.GetConfig(content); if (config.IsNone) { return(null); } config.IfSome(cfg => Mapper.Map(cfg, pagePromotion)); pagePromotion.Type = Type; pagePromotion.CreatorId = _memberService.GetByUserId(pagePromotion.UmbracoCreatorId.Value).Id; var panelValues = _gridHelper.GetValues(content, CommentsPanelAlias, LikesPanelAlias).ToList(); pagePromotion.Commentable = panelValues.Any(panel => panel.alias == CommentsPanelAlias); pagePromotion.Likeable = panelValues.Any(panel => panel.alias == LikesPanelAlias); return(pagePromotion); }
public virtual ActionResult DocumentsTable(Guid groupId, GroupDocumentDocumentField column, Direction direction) { var groupDocumentsList = _groupDocumentsService.GetByGroup(groupId).ToList(); var mediaIdsList = groupDocumentsList.Select(s => s.MediaId).ToList(); var medias = _mediaService.GetByIds(mediaIdsList); var group = _groupService.Get(groupId); var groupMembers = _groupMemberService.GetGroupMemberByGroup(groupId); var currentMember = _intranetMemberService.GetCurrentMember(); var docs = medias.Select(s => { var intranetCreator = s.GetValue <Guid?>(IntranetConstants.IntranetCreatorId); var creator = intranetCreator.HasValue ? _intranetMemberService.Get(intranetCreator.Value) : _intranetMemberService.GetByUserId(s.CreatorId); var document = groupDocumentsList.First(f => f.MediaId == s.Id); var url = _umbracoHelper.TypedMedia(s.Id).Url; var model = new GroupDocumentTableRowViewModel { CanDelete = CanDelete(currentMember, group, groupMembers, s), Id = document.Id, CreateDate = s.CreateDate, Name = s.Name, Type = s.GetValue <string>(UmbracoAliases.Media.MediaExtension), Creator = creator.Map <MemberViewModel>(), FileUrl = url }; return(model); }); docs = Sort(docs, column, direction); var viewModel = new GroupDocumentsTableViewModel { Documents = docs, GroupId = groupId, Column = column, Direction = direction }; return(PartialView(GroupDocumentsTableViewPath, viewModel)); }