public void ChangePublished(GenericCatalogTemplate genericCatalogTemplate)
        {
            if (genericCatalogTemplate.Equals(null))
                throw new ArgumentNullException("genericCatalogTemplate");

            genericCatalogTemplate.Published = !genericCatalogTemplate.Published;
            this.UpdateGenericCatalogTemplate(genericCatalogTemplate);
        }
        public void DeleteGenericCatalogTemplate(GenericCatalogTemplate genericCatalogTemplate)
        {
            if (genericCatalogTemplate.Equals(null))
                throw new ArgumentNullException("genericCatalogTemplate");

            _genericCatalogTemplateRepository.Delete(genericCatalogTemplate);

            _cacheManager.RemoveByPattern(GENERICCATALOGTEMPLATE_ALL);
            _cacheManager.RemoveByPattern(GENERICCATALOGTEMPLATE_BY_ID);
            _cacheManager.RemoveByPattern(GENERICCATALOGTEMPLATE_BY_PAGE);
        }
Ejemplo n.º 3
0
        public ActionResult AddGenericCatalogTemplate(GenericCatalogTemplateModel model, GridCommand command)
        {
            if (!ModelState.IsValid)
            {
                //display the first model error
                var modelStateErrors = this.ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage);
                return Content(modelStateErrors.FirstOrDefault());
            }

            var template = new GenericCatalogTemplate
            {
                Name = model.Name,
                ViewPath = this.FileAfterUpload(),
                DisplayOrder = model.DisplayOrder,
                Published = model.Published
            };

            _genericCatalogTemplateService.InsertGenericCatalogTemplate(template);

            return GetGenericCatalogTemplates(command);
        }