public virtual ActionResult UpdatePageCSS(PageCSSModel model) { bool isSuccessed = false; if (ModelState.IsValid) { Page page = pageService.Find(model.PageId); if (page == null || !permissionService.IsAllowed((Int32)PageOperations.Update, this.CorePrincipal(), typeof(Page), model.PageId, IsPageOwner(page), PermissionOperationLevel.Object)) { throw new HttpException((int)HttpStatusCode.NotFound, Translate("Messages.NotFound")); } var pageSettingService = ServiceLocator.Current.GetInstance <IPageSettingService>(); PageSettings pageSettings = pageSettingService.Find(model.SettingId) ?? new PageSettings { Id = model.SettingId, Page = new Page { Id = model.PageId } }; pageSettings = model.MapTo(pageSettings); isSuccessed = pageSettingService.Save(pageSettings); model.SettingId = pageSettings.Id; } if (isSuccessed) { Success(Translate("Messages.Success")); } else { Error(Translate("Messages.UnknownError")); } return(PartialView(MVC.Pages.Views.PageCSSForm, model)); }
public virtual ActionResult UpdatePageCSS(PageCSSModel model) { bool isSuccessed = false; if (ModelState.IsValid) { Page page = pageService.Find(model.PageId); if (page == null || !permissionService.IsAllowed((Int32)PageOperations.Update, this.CorePrincipal(), typeof(Page), model.PageId, IsPageOwner(page), PermissionOperationLevel.Object)) { throw new HttpException((int)HttpStatusCode.NotFound, Translate("Messages.NotFound")); } var pageSettingService = ServiceLocator.Current.GetInstance<IPageSettingService>(); PageSettings pageSettings = pageSettingService.Find(model.SettingId) ?? new PageSettings { Id = model.SettingId, Page = new Page { Id = model.PageId } }; pageSettings = model.MapTo(pageSettings); isSuccessed = pageSettingService.Save(pageSettings); model.SettingId = pageSettings.Id; } if (isSuccessed) Success(Translate("Messages.Success")); else Error(Translate("Messages.UnknownError")); return PartialView(MVC.Pages.Views.PageCSSForm, model); }