Example #1
0
        public ActionResult NewsItemCategoryInsert(GridCommand command, NewsItemModel.NewsItemCategoryModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
            {
                return(AccessDeniedView());
            }

            var newsItemCategory = new NewsItemCategory()
            {
                NewsItemId = model.NewsItemId,
                CategoryId = Int32.Parse(model.Category), //use Category property (not CategoryId) because appropriate property is stored in it
                //DisplayOrder = model.DisplayOrder
                CreatedOnUtc = DateTime.UtcNow
            };

            _categoryService.InsertNewsItemCategory(newsItemCategory);

            return(NewsItemCategoryList(command, model.NewsItemId));
        }
Example #2
0
        public ActionResult NewsItemCategoryUpdate(GridCommand command, NewsItemModel.NewsItemCategoryModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
            {
                return(AccessDeniedView());
            }

            var newsItemCategory = _categoryService.GetNewsItemCategoryById(model.Id);

            if (newsItemCategory == null)
            {
                throw new ArgumentException("No newsitem category mapping found with the specified id");
            }

            //use Category property (not CategoryId) because appropriate property is stored in it
            newsItemCategory.CategoryId = Int32.Parse(model.Category);
            _categoryService.UpdateNewsItemCategory(newsItemCategory);

            return(NewsItemCategoryList(command, newsItemCategory.NewsItemId));
        }