public ActionResult EditPartPOST(string id) { if (!Services.Authorizer.Authorize(Permissions.EditContentTypes, T("Not allowed to edit a content part."))) { return(new HttpUnauthorizedResult()); } var partViewModel = _contentDefinitionService.GetPart(id); if (partViewModel == null) { return(HttpNotFound()); } if (!TryUpdateModel(partViewModel)) { return(View(partViewModel)); } _contentDefinitionService.AlterPart(partViewModel, this); if (!ModelState.IsValid) { Services.TransactionManager.Cancel(); return(View(partViewModel)); } Services.Notifier.Information(T("\"{0}\" 设置保存成功.", partViewModel.Name)); return(RedirectToAction("ListParts")); }
public async Task <ActionResult> EditPartPOST(string id) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.EditContentTypes)) { return(new HttpUnauthorizedResult()); } var partViewModel = _contentDefinitionService.GetPart(id); if (partViewModel == null) { return(HttpNotFound()); } if (!await TryUpdateModelAsync(partViewModel)) { return(View(partViewModel)); } _contentDefinitionService.AlterPart(partViewModel, this); if (!ModelState.IsValid) { _session.Cancel(); return(View(partViewModel)); } //Services.Notifier.Information(T("\"{0}\" settings have been saved.", partViewModel.Name)); return(RedirectToAction("ListParts")); }