Exemple #1
0
        private List <PublicationSubCategory> GetPublicationSubCategories(string title)
        {
            List <PublicationSubCategory>        result         = new List <PublicationSubCategory>();
            List <StagingPublicationSubCategory> existingSubCat = new MongoDBContext <StagingPublicationSubCategory>().MongoRepositoryInstance.GetCollectionByKey("PublicationCategory.LookupValue", title).ToList();

            if (existingSubCat.IsNotNull() && existingSubCat.Any())
            {
                existingSubCat = existingSubCat.DistinctBy(key => key.Title).ToList();

                existingSubCat.ForEach(item =>
                {
                    result.Add(new PublicationSubCategory
                    {
                        AdName              = item.AdName,
                        ApprovedDate        = DateTime.Now,
                        Approver            = item.Approver,
                        Comment             = item.Comment,
                        ContentOwner        = item.ContentOwner,
                        ExpirationDate      = DateTime.Now,
                        IsDefault           = item.IsDefault,
                        ItemStatus          = item.ItemStatus,
                        ItemType            = item.ItemType,
                        Metadata            = item.Metadata,
                        Path                = item.FileDirRef,
                        PublishedDate       = item.PublishedDate,
                        StartDate           = item.StartDate,
                        Title               = item.Title,
                        Version             = item.Version,
                        BTKeyList           = item.BTKeyList.IsNotNull() ? item.BTKeyList.Split('|') : new string[] { },
                        DisplayOrder        = item.DisplayOrder,
                        PublicationCategory = item.PublicationCategory.LookupValue,
                        SPListId            = item.ID
                    });
                }
                                       );
            }
            return(result);
        }