public ActionResult ListDeletedItems() { if (!_authorizer.Authorize(Permissions.EditContent, T("Not authorized to manage versions."))) { return(new HttpUnauthorizedResult()); } ListDeletedItemsViewModel viewModel = _versionManagerWorkerService.ListDeletedItems(); return(View(viewModel)); }
public ListDeletedItemsViewModel ListDeletedItems() { ListDeletedItemsViewModel viewModel = new ListDeletedItemsViewModel { RemovedItems = _contentManager // all versions of all content items... .Query(VersionOptions.AllVersions).List() // ... group by content item id .GroupBy(item => item.Id) // ...that don't not have a "Latest" flag set in their list of revisions .Where(g => !g.Any(item => item.VersionRecord.Latest)) // ...order by version # .Select(g => g.OrderBy(item => item.Version).Last()).ToList() }; return(viewModel); }