Example #1
0
        public ActionResult NewsCatalogueInsert(NewsItemModel.NewsCatalogueModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews))
            {
                return(AccessDeniedView());
            }

            var newsId      = model.NewsId;
            var catalogueId = model.CatalogueId;

            var existingNewsCatalogues = _catalogueService.GetNewsCataloguesByCatalogueId(catalogueId, 0, int.MaxValue, true);

            if (existingNewsCatalogues.FindNewsCatalogues(newsId, catalogueId) == null)
            {
                var newsCatalogue = new NewsCatalogues
                {
                    NewsId       = newsId,
                    CatalogueId  = catalogueId,
                    DisplayOrder = model.DisplayOrder
                };

                _catalogueService.InsertNewsCatalogues(newsCatalogue);
            }

            return(new NullJsonResult());
        }
        /// <summary>
        /// Updates the news catalogues mapping
        /// </summary>
        /// <param name="newsCatalogues">>News catalogues mapping</param>
        public virtual void UpdateNewsCatalogues(NewsCatalogues newsCatalogues)
        {
            if (newsCatalogues == null)
            {
                throw new ArgumentNullException("newsCatalogues");
            }

            _newsCataloguesRepository.Update(newsCatalogues);

            //cache
            _cacheManager.RemoveByPattern(CATALOGUES_PATTERN_KEY);
            _cacheManager.RemoveByPattern(NEWSCATALOGUES_PATTERN_KEY);

            //event notification
            _eventPublisher.EntityUpdated(newsCatalogues);
        }