public ActionResult ForEntity(Guid entityId) { var searchPage = _searchUmbracoHelper.GetSearchPage(); var tags = _tagsService .Get(entityId) .Select(tag => MapToViewModel(tag, searchPage.Url)) .ToList(); return(PartialView(EntityTagsViewPath, tags)); }
public void GetTagTest() { var tagInfo = _userTagService.Get(); Assert.NotNull(tagInfo); Assert.True(tagInfo.Any()); }
public override ConverterResponseModel MapViewModel(ProfilePageModel node, ProfilePageViewModel viewModel) { var id = _uBaselineRequestContext.ParseQueryString("id").TryParseGuid(); if (!id.HasValue) { return(NotFoundResult()); } var member = _memberService.Get(id.Value); if (member == null) { return(NotFoundResult()); } var currentMemberId = _memberService.GetCurrentMemberId(); if (member.Id == currentMemberId) { viewModel.EditProfileLink = _intranetUserContentProvider.GetEditPage().Url.ToLinkModel(); } var mediaSettings = _mediaHelper.GetMediaFolderSettings(MediaFolderTypeEnum.MembersContent, true); viewModel.Profile = member.Map <ProfileViewModel>(); viewModel.Profile.Photo = _imageHelper.GetImageWithResize(member.Photo, PresetStrategies.ForMemberProfile.ThumbnailPreset); viewModel.Profile.AllowedMediaExtensions = mediaSettings.AllowedMediaExtensions; viewModel.Tags = _userTagService.Get(member.Id); return(OkResult()); }
private SearchableUintraActivity Map(Entities.Social social) { var searchableActivity = social.Map <SearchableUintraActivity>(); searchableActivity.Url = _activityLinkService.GetLinks(social.Id).Details; searchableActivity.UserTagNames = _userTagService.Get(social.Id).Select(t => t.Text); return(searchableActivity); }
private SearchableUintraActivity Map(Bulletin bulletin) { var searchableActivity = bulletin.Map <SearchableUintraActivity>(); searchableActivity.Url = _linkService.GetLinks(bulletin.Id).Details; searchableActivity.UserTagNames = _userTagService.Get(bulletin.Id).Select(t => t.Text); return(searchableActivity); }
private SearchableUintraActivity Map(Event @event) { var searchableActivity = @event.Map <SearchableUintraActivity>(); searchableActivity.Url = _activityLinkService.GetLinks(@event.Id).Details; searchableActivity.UserTagNames = _userTagService.Get(@event.Id).Select(t => t.Text); return(searchableActivity); }
private SearchableUintraActivity Map(Entities.News news) { var searchableActivity = news.Map <SearchableUintraActivity>(); searchableActivity.Url = _linkService.GetLinks(news.Id).Details; searchableActivity.UserTagNames = _userTagService.Get(news.Id).Select(t => t.Text); return(searchableActivity); }
private SearchableUser MapToSearchableUser(IntranetUser user) { var searchableUser = user.Map <SearchableUser>(); searchableUser.Url = _intranetUserContentProvider.GetProfilePage().Url.AddIdParameter(user.Id); searchableUser.UserTagNames = _userTagService.Get(user.Id).Select(t => t.Text).ToList(); return(searchableUser); }
public virtual T Map(IGroupMember member) { var searchableUser = member.Map <T>(); searchableUser.Url = _intranetUserContentProvider.GetProfilePage().Url.AddIdParameter(member.Id).ToLinkModel(); searchableUser.UserTagNames = _userTagService.Get(member.Id).Select(t => t.Text).ToList(); searchableUser.Groups = FillGroupInfo(member); return(searchableUser); }
public TagsPickerViewModel GetTagsViewModel(Guid?entityId = null) { var pickerViewModel = new TagsPickerViewModel { UserTagCollection = _tagProvider.GetAll(), TagIdsData = entityId.HasValue ? _tagsService.Get(entityId.Value).Select(t => t.Id) : Enumerable.Empty <Guid>() }; return(pickerViewModel); }
private TagPickerViewModel GetPickerViewModel(Guid?entityId) { var pickerViewModel = new TagPickerViewModel { UserTagCollection = _tagProvider.GetAll().Map <IEnumerable <LabeledIdentity <Guid> > >(), TagIdsData = entityId.HasValue ? _tagsService.Get(entityId.Value).Select(t => t.Id) : Enumerable.Empty <Guid>() }; return(pickerViewModel); }
public void Map( ProfileEditPageModel node, ProfileEditPageViewModel viewModel) { var member = _intranetMemberService.GetCurrentMember(); viewModel.Profile = member.Map <ProfileEditViewModel>(); viewModel.Tags = _userTagService.Get(member.Id); viewModel.AvailableTags = _userTagProvider.GetAll(); viewModel.Profile.MemberNotifierSettings = _memberNotifiersSettingsService.GetForMember(member.Id); viewModel.Profile.Photo = MapPhoto(viewModel.Profile.Photo); }
public override ConverterResponseModel MapViewModel(SocialEditPageModel node, SocialEditPageViewModel viewModel) { var id = _context.ParseQueryString("id").TryParseGuid(); if (!id.HasValue) { return(NotFoundResult()); } var social = _socialService.Get(id.Value); if (social == null) { return(NotFoundResult()); } if (social.GroupId.HasValue) { var group = _groupService.Get(social.GroupId.Value); if (group != null && group.IsHidden) { return(NotFoundResult()); } } if (!_socialService.CanEdit(id.Value)) { return(ForbiddenResult()); } viewModel.CanDelete = _socialService.CanDelete(id.Value); viewModel.OwnerId = social.OwnerId; viewModel.Id = social.Id; viewModel.Description = social.Description; viewModel.Name = _localizationModelService["Social.Edit"]; viewModel.Tags = _userTagService.Get(id.Value); viewModel.LightboxPreviewModel = _lightboxHelper.GetGalleryPreviewModel(social.MediaIds, PresetStrategies.ForActivityDetails); viewModel.AvailableTags = _userTagProvider.GetAll(); viewModel.Links = _feedLinkService.GetLinks(social.Id); var mediaSettings = _socialService.GetMediaSettings(); viewModel.AllowedMediaExtensions = mediaSettings.AllowedMediaExtensions; var groupId = HttpContext.Current.Request["groupId"].TryParseGuid(); if (groupId.HasValue && social.GroupId == groupId.Value) { viewModel.GroupHeader = _groupHelper.GetHeader(groupId.Value); } return(OkResult()); }
public override ConverterResponseModel MapViewModel(EventDetailsPageModel node, EventDetailsPageViewModel viewModel) { var idStr = HttpUtility.ParseQueryString(_baselineRequestContext.NodeRequestParams.NodeUrl.Query) .TryGetQueryValue <string>("id"); if (!Guid.TryParse(idStr, out var id)) { return(NotFoundResult()); } var @event = _eventsService.Get(id); if (@event == null || @event.IsHidden) { return(NotFoundResult()); } if (@event.GroupId.HasValue) { var group = _groupService.Get(@event.GroupId.Value); if (group != null && group.IsHidden) { return(NotFoundResult()); } } if (!_permissionsService.Check(PermissionResourceTypeEnum.Events, PermissionActionEnum.View)) { return(ForbiddenResult()); } var member = _memberService.GetCurrentMember(); viewModel.Details = GetDetails(@event); viewModel.Tags = _userTagService.Get(id); viewModel.CanEdit = _eventsService.CanEdit(id); viewModel.IsGroupMember = [email protected] || member.GroupIds.Contains(@event.GroupId.Value); var groupIdStr = HttpContext.Current.Request["groupId"]; if (Guid.TryParse(groupIdStr, out var groupId) && @event.GroupId == groupId) { viewModel.GroupHeader = _groupHelper.GetHeader(groupId); } return(OkResult()); }
private NewsViewModel GetDetails(Entities.News news) { var details = news.Map <NewsViewModel>(); details.Media = MediaHelper.GetMediaUrls(news.MediaIds); details.CanEdit = _newsService.CanEdit(news); details.Links = _feedLinkService.GetLinks(news.Id); details.IsReadOnly = false; details.HeaderInfo = news.Map <IntranetActivityDetailsHeaderViewModel>(); details.HeaderInfo.Dates = news.PublishDate.ToDateTimeFormat().ToEnumerable(); details.HeaderInfo.Owner = _memberService.Get(news).ToViewModel(); details.Tags = _userTagService.Get(news.Id); details.AvailableTags = _userTagProvider.GetAll(); details.LightboxPreviewModel = _lightboxHelper.GetGalleryPreviewModel(news.MediaIds, PresetStrategies.ForActivityDetails); return(details); }
public override ConverterResponseModel MapViewModel(SocialDetailsPageModel node, SocialDetailsPageViewModel viewModel) { var id = _context.ParseQueryString("id").TryParseGuid(); if (!id.HasValue) { return(NotFoundResult()); } var social = _socialService.Get(id.Value); if (social == null) { return(NotFoundResult()); } if (social.GroupId.HasValue) { var group = _groupService.Get(social.GroupId.Value); if (group != null && group.IsHidden) { return(NotFoundResult()); } } if (!_permissionsService.Check(PermissionResourceTypeEnum.Social, PermissionActionEnum.View)) { return(ForbiddenResult()); } var member = _memberService.GetCurrentMember(); viewModel.Details = GetViewModel(social); viewModel.Tags = _userTagService.Get(id.Value); viewModel.CanEdit = _socialService.CanEdit(id.Value); viewModel.IsGroupMember = !social.GroupId.HasValue || member.GroupIds.Contains(social.GroupId.Value); var groupIdStr = HttpContext.Current.Request["groupId"]; if (Guid.TryParse(groupIdStr, out var groupId) && social.GroupId == groupId) { viewModel.GroupHeader = _groupHelper.GetHeader(groupId); } return(OkResult()); }
private EventViewModel GetDetails(Event @event) { var details = @event.Map <EventViewModel>(); details.Media = MediaHelper.GetMediaUrls(@event.MediaIds); details.CanEdit = _eventService.CanEdit(@event); details.Links = _feedLinkService.GetLinks(@event.Id); details.IsReadOnly = false; details.HeaderInfo = @event.Map <IntranetActivityDetailsHeaderViewModel>(); details.HeaderInfo.Dates = @event.PublishDate.ToDateTimeFormat().ToEnumerable(); details.HeaderInfo.Owner = _memberService.Get(@event).ToViewModel(); details.Tags = _userTagService.Get(@event.Id); details.AvailableTags = _userTagProvider.GetAll(); details.LightboxPreviewModel = _lightboxHelper.GetGalleryPreviewModel(@event.MediaIds, PresetStrategies.ForActivityDetails); details.CanSubscribe = _eventService.CanSubscribe(@event.Id); var subscribe = @event.Subscribers.FirstOrDefault(x => x.UserId == _memberService.GetCurrentMemberId()); details.IsSubscribed = subscribe != null; details.IsNotificationsDisabled = subscribe?.IsNotificationDisabled ?? false; return(details); }