示例#1
0
        private ActionResult RenderGroupNavigation()
        {
            var groupId    = Request.QueryString.GetGroupIdOrNone();
            var validGroup = groupId.Map(_groupService.Get);

            return(validGroup.Match(
                       Some: group =>
            {
                var groupNavigationModel = group.IsHidden
                        ? new GroupNavigationViewModel {
                    GroupTitle = group.Title
                }
                        : new GroupNavigationViewModel
                {
                    GroupTitle = group.Title,
                    GroupUrl = _groupLinkProvider.GetGroupLink(group.Id),
                    ActivityTabs = _groupFeedContentService
                                   .GetMainFeedTab(CurrentPage, group.Id)
                                   .ToEnumerable()
                                   .Map <IEnumerable <GroupNavigationActivityTabViewModel> >(),
                    PageTabs = _groupFeedContentService
                               .GetPageTabs(CurrentPage, group.Id)
                               .Select(t => MapToGroupPageTabViewModel(t, _groupContentProvider.GetEditPage()))
                               .ToList()
                };

                return PartialView(GroupNavigationViewPath, groupNavigationModel);
            },
                       None: () => (ActionResult) new EmptyResult()));
        }
        private ActionResult RenderGroupNavigation()
        {
            var groupId = Request.QueryString.GetGroupId();

            if (!groupId.HasValue)
            {
                return(new EmptyResult());
            }
            var group = _groupService.Get(groupId.Value);

            if (group == null)
            {
                return(new EmptyResult());
            }

            var groupNavigationModel = new GroupNavigationViewModel {
                GroupTitle = @group.Title
            };

            if (!group.IsHidden)
            {
                groupNavigationModel.GroupUrl = _groupLinkProvider.GetGroupLink(group.Id);

                groupNavigationModel.ActivityTabs = _groupFeedContentService
                                                    .GetMainFeedTab(CurrentPage, groupId.Value)
                                                    .ToEnumerable()
                                                    .Map <IEnumerable <GroupNavigationActivityTabViewModel> >();

                var currentUser   = _intranetUserService.GetCurrentUser();
                var groupEditPage = _groupContentProvider.GetEditPage();
                groupNavigationModel.PageTabs = _groupFeedContentService
                                                .GetPageTabs(CurrentPage, currentUser, groupId.Value)
                                                .Select(t => MapToGroupPageTabViewModel(t, groupEditPage));
            }


            return(PartialView(GroupNavigationViewPath, groupNavigationModel));
        }