當前位置: 首頁>>代碼示例>>C#>>正文


C# Topics.Topic類代碼示例

本文整理匯總了C#中Nop.Core.Domain.Topics.Topic的典型用法代碼示例。如果您正苦於以下問題:C# Topic類的具體用法?C# Topic怎麽用?C# Topic使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Topic類屬於Nop.Core.Domain.Topics命名空間,在下文中一共展示了Topic類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: UpdateLocales

        protected void UpdateLocales(Topic topic, TopicModel model)
        {
            foreach (var localized in model.Locales)
            {
                _localizedEntityService.SaveLocalizedValue(topic,
                                                               x => x.Title,
                                                               localized.Title,
                                                               localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(topic,
                                                           x => x.Body,
                                                           localized.Body,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(topic,
                                                           x => x.MetaKeywords,
                                                           localized.MetaKeywords,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(topic,
                                                           x => x.MetaDescription,
                                                           localized.MetaDescription,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(topic,
                                                           x => x.MetaTitle,
                                                           localized.MetaTitle,
                                                           localized.LanguageId);

                //search engine name
                var seName = topic.ValidateSeName(localized.SeName, localized.Title, false);
                _urlRecordService.SaveSlug(topic, seName, localized.LanguageId);
            }
        }
開發者ID:haithemChkel,項目名稱:nopCommerce_33,代碼行數:34,代碼來源:TopicController.cs

示例2: Can_save_and_load_topic

        public void Can_save_and_load_topic()
        {
            var topic = new Topic
                               {
                                   SystemName = "SystemName 1",
                                   IncludeInSitemap = true,
                                   IsPasswordProtected = true,
                                   Password = "password",
                                   Title = "Title 1",
                                   Body = "Body 1",
                                   MetaKeywords = "Meta keywords",
                                   MetaDescription = "Meta description",
                                   MetaTitle = "Meta title",
                               };

            var fromDb = SaveAndLoadEntity(topic);
            fromDb.ShouldNotBeNull();
            fromDb.SystemName.ShouldEqual("SystemName 1");
            fromDb.IncludeInSitemap.ShouldEqual(true);
            fromDb.IsPasswordProtected.ShouldEqual(true);
            fromDb.Password.ShouldEqual("password");
            fromDb.Title.ShouldEqual("Title 1");
            fromDb.Body.ShouldEqual("Body 1");
            fromDb.MetaKeywords.ShouldEqual("Meta keywords");
            fromDb.MetaDescription.ShouldEqual("Meta description");
            fromDb.MetaTitle.ShouldEqual("Meta title");
        }
開發者ID:nopmcs,項目名稱:mycreativestudio,代碼行數:27,代碼來源:TopicPersistenceTests.cs

示例3: DeleteTopic

        /// <summary>
        /// Deletes a topic
        /// </summary>
        /// <param name="topic">Topic</param>
        public virtual void DeleteTopic(Topic topic)
        {
            if (topic == null)
                throw new ArgumentNullException("topic");

            _topicRepository.Delete(topic);

            //event notification
            _eventPublisher.EntityDeleted(topic);
        }
開發者ID:rajendra1809,項目名稱:nopCommerce,代碼行數:14,代碼來源:TopicService.cs

示例4: DeleteTopic

        /// <summary>
        /// Deletes a topic
        /// </summary>
        /// <param name="topic">Topic</param>
        public virtual void DeleteTopic(Topic topic)
        {
            if (topic == null)
                throw new ArgumentNullException("topic");

            _topicRepository.Delete(topic);

            //cache
            _cacheManager.RemoveByPattern(TOPICS_PATTERN_KEY);
            //event notification
            _eventPublisher.EntityDeleted(topic);
        }
開發者ID:powareverb,項目名稱:grandnode,代碼行數:16,代碼來源:TopicService.cs

示例5: Can_save_and_load_topic

        public void Can_save_and_load_topic()
        {
            var topic = new Topic
                               {
                                   SystemName = "SystemName 1",
                                   IncludeInSitemap = true,
                                   IncludeInTopMenu = true,
                                   IncludeInFooterColumn1 = true,
                                   IncludeInFooterColumn2 = true,
                                   IncludeInFooterColumn3 = true,
                                   DisplayOrder = 1,
                                   AccessibleWhenStoreClosed = true,
                                   IsPasswordProtected = true,
                                   Password = "password",
                                   Title = "Title 1",
                                   Body = "Body 1",
                                   Published = true,
                                   TopicTemplateId = 1,
                                   MetaKeywords = "Meta keywords",
                                   MetaDescription = "Meta description",
                                   MetaTitle = "Meta title",
                                   SubjectToAcl = true,
                                   LimitedToStores = true
                               };

            var fromDb = SaveAndLoadEntity(topic);
            fromDb.ShouldNotBeNull();
            fromDb.SystemName.ShouldEqual("SystemName 1");
            fromDb.IncludeInSitemap.ShouldEqual(true);
            fromDb.IncludeInTopMenu.ShouldEqual(true);
            fromDb.IncludeInFooterColumn1.ShouldEqual(true);
            fromDb.IncludeInFooterColumn2.ShouldEqual(true);
            fromDb.IncludeInFooterColumn3.ShouldEqual(true);
            fromDb.DisplayOrder.ShouldEqual(1);
            fromDb.AccessibleWhenStoreClosed.ShouldEqual(true);
            fromDb.IsPasswordProtected.ShouldEqual(true);
            fromDb.Password.ShouldEqual("password");
            fromDb.Title.ShouldEqual("Title 1");
            fromDb.Body.ShouldEqual("Body 1");
            fromDb.Published.ShouldEqual(true);
            fromDb.TopicTemplateId.ShouldEqual(1);
            fromDb.MetaKeywords.ShouldEqual("Meta keywords");
            fromDb.MetaDescription.ShouldEqual("Meta description");
            fromDb.MetaTitle.ShouldEqual("Meta title");
            fromDb.SubjectToAcl.ShouldEqual(true);
            fromDb.LimitedToStores.ShouldEqual(true);
        }
開發者ID:RobinHoody,項目名稱:nopCommerce,代碼行數:47,代碼來源:TopicPersistenceTests.cs

示例6: PrepareTopicModel

        protected virtual TopicModel PrepareTopicModel(Topic topic)
        {
            if (topic == null)
                throw new ArgumentNullException("topic");

            var model = new TopicModel()
            {
                Id = topic.Id,
                SystemName = topic.SystemName,
                IncludeInSitemap = topic.IncludeInSitemap,
                IsPasswordProtected = topic.IsPasswordProtected,
                Title = topic.IsPasswordProtected ? "" : topic.GetLocalized(x => x.Title),
                Body = topic.IsPasswordProtected ? "" : topic.GetLocalized(x => x.Body),
                MetaKeywords = topic.GetLocalized(x => x.MetaKeywords),
                MetaDescription = topic.GetLocalized(x => x.MetaDescription),
                MetaTitle = topic.GetLocalized(x => x.MetaTitle),
                SeName = topic.GetSeName(),
            };
            return model;
        }
開發者ID:minuzZ,項目名稱:zelectroshop,代碼行數:20,代碼來源:TopicController.cs

示例7: SaveStoreMappings

 protected virtual void SaveStoreMappings(Topic topic, TopicModel model)
 {
     var existingStoreMappings = _storeMappingService.GetStoreMappings(topic);
     var allStores = _storeService.GetAllStores();
     foreach (var store in allStores)
     {
         if (model.SelectedStoreIds != null && model.SelectedStoreIds.Contains(store.Id))
         {
             //new store
             if (existingStoreMappings.Count(sm => sm.StoreId == store.Id) == 0)
                 _storeMappingService.InsertStoreMapping(topic, store.Id);
         }
         else
         {
             //remove store
             var storeMappingToDelete = existingStoreMappings.FirstOrDefault(sm => sm.StoreId == store.Id);
             if (storeMappingToDelete != null)
                 _storeMappingService.DeleteStoreMapping(storeMappingToDelete);
         }
     }
 }
開發者ID:Rustemt,項目名稱:Nopcommerce-with-Couchbase,代碼行數:21,代碼來源:TopicController.cs

示例8: PrepareStoresMappingModel

        protected virtual void PrepareStoresMappingModel(TopicModel model, Topic topic, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            model.AvailableStores = _storeService
                .GetAllStores()
                .Select(s => s.ToModel())
                .ToList();
            if (!excludeProperties)
            {
                if (topic != null)
                {
                    model.SelectedStoreIds = _storeMappingService.GetStoresIdsWithAccess(topic);
                }
            }
        }
開發者ID:Rustemt,項目名稱:Nopcommerce-with-Couchbase,代碼行數:17,代碼來源:TopicController.cs

示例9: UpdateLocales

        protected void UpdateLocales(Topic topic, TopicModel model)
        {
            foreach (var localized in model.Locales)
            {
                _localizedEntityService.SaveLocalizedValue(topic,
                                                               x => x.Title,
                                                               localized.Title,
                                                               localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(topic,
                                                           x => x.Body,
                                                           localized.Body,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(topic,
                                                           x => x.MetaKeywords,
                                                           localized.MetaKeywords,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(topic,
                                                           x => x.MetaDescription,
                                                           localized.MetaDescription,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(topic,
                                                           x => x.MetaTitle,
                                                           localized.MetaTitle,
                                                           localized.LanguageId);
            }
        }
開發者ID:richardspencer27,項目名稱:RLBryan,代碼行數:30,代碼來源:TopicController.cs

示例10: ToEntity

 public static Topic ToEntity(this TopicModel model, Topic destination)
 {
     return Mapper.Map(model, destination);
 }
開發者ID:nguyentu1982,項目名稱:quancu,代碼行數:4,代碼來源:MappingExtensions.cs

示例11: SaveTopicAcl

 protected virtual void SaveTopicAcl(Topic topic, TopicModel model)
 {
     var existingAclRecords = _aclService.GetAclRecords(topic);
     var allCustomerRoles = _customerService.GetAllCustomerRoles(true);
     foreach (var customerRole in allCustomerRoles)
     {
         if (model.SelectedCustomerRoleIds != null && model.SelectedCustomerRoleIds.Contains(customerRole.Id))
         {
             //new role
             if (existingAclRecords.Count(acl => acl.CustomerRoleId == customerRole.Id) == 0)
                 _aclService.InsertAclRecord(topic, customerRole.Id);
         }
         else
         {
             //remove role
             var aclRecordToDelete = existingAclRecords.FirstOrDefault(acl => acl.CustomerRoleId == customerRole.Id);
             if (aclRecordToDelete != null)
                 _aclService.DeleteAclRecord(aclRecordToDelete);
         }
     }
 }
開發者ID:aumankit,項目名稱:nop,代碼行數:21,代碼來源:TopicController.cs

示例12: PrepareAclModel

        protected virtual void PrepareAclModel(TopicModel model, Topic topic, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            model.AvailableCustomerRoles = _customerService
                .GetAllCustomerRoles(true)
                .Select(cr => cr.ToModel())
                .ToList();
            if (!excludeProperties)
            {
                if (topic != null)
                {
                    model.SelectedCustomerRoleIds = _aclService.GetCustomerRoleIdsWithAccess(topic);
                }
            }
        }
開發者ID:aumankit,項目名稱:nop,代碼行數:17,代碼來源:TopicController.cs

示例13: PrepareStoresMappingModel

        protected virtual void PrepareStoresMappingModel(TopicModel model, Topic topic, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            if (!excludeProperties && topic != null)
                model.SelectedStoreIds = _storeMappingService.GetStoresIdsWithAccess(topic).ToList();

            var allStores = _storeService.GetAllStores();
            foreach (var store in allStores)
            {
                model.AvailableStores.Add(new SelectListItem
                {
                    Text = store.Name,
                    Value = store.Id.ToString(),
                    Selected = model.SelectedStoreIds.Contains(store.Id)
                });
            }
        }
開發者ID:RobinHoody,項目名稱:nopCommerce,代碼行數:19,代碼來源:TopicController.cs

示例14: PrepareAclModel

        protected virtual void PrepareAclModel(TopicModel model, Topic topic, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            if (!excludeProperties && topic != null)
                model.SelectedCustomerRoleIds = _aclService.GetCustomerRoleIdsWithAccess(topic).ToList();

            var allRoles = _customerService.GetAllCustomerRoles(true);
            foreach (var role in allRoles)
            {
                model.AvailableCustomerRoles.Add(new SelectListItem
                {
                    Text = role.Name,
                    Value = role.Id.ToString(),
                    Selected = model.SelectedCustomerRoleIds.Contains(role.Id)
                });
            }
        }
開發者ID:RobinHoody,項目名稱:nopCommerce,代碼行數:19,代碼來源:TopicController.cs

示例15: UpdateLocales

        protected virtual List<LocalizedProperty> UpdateLocales(Topic topic, TopicModel model)
        {
            List<LocalizedProperty> localized = new List<LocalizedProperty>();

            foreach (var local in model.Locales)
            {
                var seName = topic.ValidateSeName(local.SeName, local.Title, false);
                _urlRecordService.SaveSlug(topic, seName, local.LanguageId);

                if (!(String.IsNullOrEmpty(seName)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "SeName",
                        LocaleValue = seName
                    });

                if (!(String.IsNullOrEmpty(local.Body)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "Body",
                        LocaleValue = local.Body
                    });

                if (!(String.IsNullOrEmpty(local.MetaDescription)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "MetaDescription",
                        LocaleValue = local.MetaDescription
                    });

                if (!(String.IsNullOrEmpty(local.MetaKeywords)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "MetaKeywords",
                        LocaleValue = local.MetaKeywords
                    });

                if (!(String.IsNullOrEmpty(local.MetaTitle)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "MetaTitle",
                        LocaleValue = local.MetaTitle
                    });

                if (!(String.IsNullOrEmpty(local.Title)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "Title",
                        LocaleValue = local.Title
                    });

            }
            return localized;
        }
開發者ID:powareverb,項目名稱:grandnode,代碼行數:60,代碼來源:TopicController.cs


注:本文中的Nop.Core.Domain.Topics.Topic類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。