当前位置: 首页>>代码示例>>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;未经允许,请勿转载。