public async Task <ActionResult> Create(PageEditorVM vm) { if (!ModelState.IsValid) { return(await ViewEditorFormAsync(vm)); } try { var page = await _pages.CreateAsync(vm, User); await _db.SaveChangesAsync(); await _search.AddPageAsync(page); _alarm.FireTreeLayoutRegenerationRequired(); return(RedirectToSuccess("Страница создана")); } catch (ValidationException ex) { SetModelState(ex); return(await ViewEditorFormAsync(vm)); } }
public async Task <ActionResult> Create(RelationEditorVM vm) { if (!ModelState.IsValid) { return(await ViewEditorFormAsync(vm)); } try { await _rels.CreateAsync(vm, User); await _db.SaveChangesAsync(); _alarm.FireTreeLayoutRegenerationRequired(); return(RedirectToSuccess("Связь создана")); } catch (ValidationException ex) { SetModelState(ex); return(await ViewEditorFormAsync(vm)); } }
public async Task <ActionResult> Update(UpdateDynamicConfigVM vm) { var oldValue = await _configMgr.RequestUpdateAsync(); await _configMgr.UpdateAsync(vm); await _db.SaveChangesAsync(); _config.ResetCache(); if (oldValue.TreeRenderThoroughness != vm.TreeRenderThoroughness) { _alarm.FireTreeLayoutRegenerationRequired(); } return(RedirectToSuccess("Настройки сохранены")); }