示例#1
0
        protected virtual NewsViewModel GetViewModel(NewsBase news)
        {
            var model = news.Map <NewsViewModel>();

            model.HeaderInfo       = news.Map <IntranetActivityDetailsHeaderViewModel>();
            model.HeaderInfo.Dates = news.PublishDate.ToDateTimeFormat().ToEnumerable();
            model.HeaderInfo.Owner = _intranetUserService.Get(news);
            model.CanEdit          = _newsService.CanEdit(news);
            return(model);
        }
示例#2
0
        private async Task <NewsViewModel> GetViewModelAsync(NewsBase news)
        {
            var model = news.Map <NewsViewModel>();

            model.HeaderInfo       = news.Map <IntranetActivityDetailsHeaderViewModel>();
            model.HeaderInfo.Dates = news.PublishDate.ToDateTimeFormat().ToEnumerable();
            model.HeaderInfo.Owner = (await _intranetMemberService.GetAsync(news)).ToViewModel();
            model.Links            = await _activityLinkService.GetLinksAsync(model.Id);

            model.HeaderInfo.Links = await _activityLinkService.GetLinksAsync(model.Id);

            model.CanEdit = _newsService.CanEdit(news);

            return(model);
        }
        protected virtual NewsViewModel GetViewModel(NewsBase news, ActivityFeedOptions options)
        {
            var model = news.Map <NewsViewModel>();

            model.CanEdit    = _newsService.CanEdit(news);
            model.Links      = options.Links;
            model.IsReadOnly = options.IsReadOnly;

            model.HeaderInfo       = news.Map <IntranetActivityDetailsHeaderViewModel>();
            model.HeaderInfo.Dates = List(news.PublishDate.ToDateTimeFormat());
            model.HeaderInfo.Owner = _intranetMemberService.Get(news).Map <MemberViewModel>();
            model.HeaderInfo.Links = options.Links;

            return(model);
        }
示例#4
0
        protected virtual NewsItemViewModel GetItemViewModel(NewsBase news, IActivityLinks links)
        {
            var model = news.Map <NewsItemViewModel>();

            model.MediaIds = news.MediaIds;
            model.Expired  = _newsService.IsExpired(news);
            model.Links    = links;

            model.HeaderInfo       = news.Map <IntranetActivityItemHeaderViewModel>();
            model.HeaderInfo.Owner = _intranetUserService.Get(news);
            model.HeaderInfo.Links = links;

            model.LightboxGalleryPreviewInfo = new LightboxGalleryPreviewModel
            {
                MediaIds             = news.MediaIds,
                DisplayedImagesCount = DisplayedImagesCount,
                ActivityId           = news.Id,
                ActivityType         = news.Type
            };
            return(model);
        }
示例#5
0
        protected virtual NewsEditModel GetEditViewModel(NewsBase news, ActivityLinks links)
        {
            var model         = news.Map <NewsEditModel>();
            var mediaSettings = _newsService.GetMediaSettings();

            model.MediaRootId = mediaSettings.MediaRootId;
            FillMediaSettingsData(mediaSettings);

            model.Links = links;

            return(model);
        }