public void ChangePublished(CatalogTemplate catalogTemplate) { if (catalogTemplate.Equals(null)) throw new ArgumentNullException("catalogTemplate"); catalogTemplate.Published = !catalogTemplate.Published; this.UpdateCatalogTemplate(catalogTemplate); }
public void DeleteCatalogTemplate(CatalogTemplate catalogTemplate) { if (catalogTemplate.Equals(null)) throw new ArgumentNullException("catalogTemplate"); _catalogTemplatesRepository.Delete(catalogTemplate); _cacheManager.RemoveByPattern(CATALOGTEMPLATE_ALL); _cacheManager.RemoveByPattern(CATALOGTEMPLATE_BY_PAGE); _cacheManager.RemoveByPattern(CATALOGTEMPLATE_BY_ID); }
public ActionResult AddCatalogTemplate(CatalogTemplateModel 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 CatalogTemplate { Name = model.Name, ViewPath = this.FileAfterUpload(), DisplayOrder = model.DisplayOrder, Published = model.Published }; _catalogTemplateService.InsertCatalogTemplate(template); return GetCatalogTemplates(command); }