public ActionResult Index()
        {
            var list = this.projectRepository.List()
                       .OrderBy(x => x.CreatedBy.Equals(User.Identity.Name))
                       .ThenBy(x => x.Created);

            var model = new ProjectsItemListing();

            foreach (var item in list)
            {
                var items = this.projectRepository.ListItems(item.ID)
                            .Select(x => this.contentLoader.Get <IContent>(x.ContentLink, new LoaderOptions {
                    new ProjectLoaderOption {
                        ProjectIds = new[] { item.ID }
                    }
                }));
                var projectItem = new ProjectsItem(item)
                {
                    Count          = items.Count(),
                    PendingPublish = items
                                     .OfType <IVersionable>()
                                     .Where(x => x.Status == VersionStatus.CheckedIn || x.IsPendingPublish)
                                     .Count(),
                    LastUpdated = items
                                  .Select(x => this.contentVersionRepository.Load(x.ContentLink))
                                  .OrderBy(x => x.Saved)
                                  .FirstOrDefault(version => version.IsMasterLanguageBranch).Saved
                };

                if (item.CreatedBy.Equals(User.Identity.Name, System.StringComparison.OrdinalIgnoreCase))
                {
                    model.MyListings.Add(projectItem);
                }
                else
                {
                    model.OtherListings.Add(projectItem);
                }
            }

            return(View("~/Business/ProjectsAdmin/Views/Index.cshtml", model));
        }
Exemplo n.º 2
0
 public static ProjectsItem CreateProjectsItem(int ID)
 {
     ProjectsItem projectsItem = new ProjectsItem();
     projectsItem.Id = ID;
     return projectsItem;
 }
Exemplo n.º 3
0
 public void AddToProjects(ProjectsItem projectsItem)
 {
     base.AddObject("Projects", projectsItem);
 }