public ActionResult ListByArchive(string path) { var cAsePath = _archiveConstraint.FindPath(path); var archive = _archiveConstraint.FindArchiveData(path); if (cAsePath == null) { return(HttpNotFound()); } if (archive == null) { return(HttpNotFound()); } CasePart cAsePart = _cAseService.Get(cAsePath); if (cAsePart == null) { return(HttpNotFound()); } if (archive.ToDateTime() == DateTime.MinValue) { // render the archive data return(new ShapeResult(this, Shape.Parts_Cases_CaseArchives(Case: cAsePart, Archives: _cAsePostService.GetArchives(cAsePart)))); } var list = Shape.List(); list.AddRange(_cAsePostService.Get(cAsePart, archive).Select(b => _services.ContentManager.BuildDisplay(b, "Summary"))); _feedManager.Register(cAsePart, _services.ContentManager.GetItemMetadata(cAsePart).DisplayText); var viewModel = Shape.ViewModel() .ContentItems(list) .Case(cAsePart) .ArchiveData(archive); return(View(viewModel)); }
public ActionResult ListByArchive(string path) { var blogPath = _archiveConstraint.FindPath(path); var archive = _archiveConstraint.FindArchiveData(path); if (blogPath == null) { return(HttpNotFound()); } if (archive == null) { return(HttpNotFound()); } BlogPart blogPart = _blogService.Get(blogPath); if (blogPart == null) { return(HttpNotFound()); } var list = Shape.List(); list.AddRange(_blogPostService.Get(blogPart, archive).Select(b => _services.ContentManager.BuildDisplay(b, "Summary"))); _feedManager.Register(blogPart); dynamic viewModel = Shape.ViewModel() .ContentItems(list) .Blog(blogPart) .ArchiveData(archive); // Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation. return(View((object)viewModel)); }