public ActionResult List()
        {
            var list = Services.New.List();

            list.AddRange(_caseService.Get(VersionOptions.Latest)
                          .Where(x => Services.Authorizer.Authorize(Permissions.MetaListOwnCases, x))
                          .Select(b => {
                var cAse            = Services.ContentManager.BuildDisplay(b, "SummaryAdmin");
                cAse.TotalPostCount = _casePostService.PostCount(b, VersionOptions.Latest);
                return(cAse);
            }));

            var viewModel = Services.New.ViewModel()
                            .ContentItems(list);

            return(View(viewModel));
        }
Beispiel #2
0
        public ActionResult Item(int cAseId, PagerParameters pagerParameters)
        {
            Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);

            var cAsePart = _cAseService.Get(cAseId, VersionOptions.Published).As <CasePart>();

            if (cAsePart == null)
            {
                return(HttpNotFound());
            }

            if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.ViewContent, cAsePart, T("Cannot view content")))
            {
                return(new HttpUnauthorizedResult());
            }

            pager.PageSize = cAsePart.PostsPerPage;

            _feedManager.Register(cAsePart, _services.ContentManager.GetItemMetadata(cAsePart).DisplayText);
            var cAsePosts = _cAsePostService.Get(cAsePart, pager.GetStartIndex(), pager.PageSize)
                            .Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));
            dynamic cAse = _services.ContentManager.BuildDisplay(cAsePart);

            var list = Shape.List();

            list.AddRange(cAsePosts);

            cAse.Content.Add(Shape.Parts_Cases_CasePost_List(ContentItems: list), "5");

            var totalItemCount = _cAsePostService.PostCount(cAsePart);

            cAse.Content.Add(Shape.Pager(pager).TotalItemCount(totalItemCount), "Content:after");


            return(new ShapeResult(this, cAse));
        }