public async Task <ActionResult> Update(EditSectionModel model) { if (_contextService.GetCurrentAccount(HttpContext).AccountName != "admin") { return(Json(new { success = false, errorMsg = "只有系统管理员才能修改版块。" })); } var result = await _commandService.ExecuteAsync(new ChangeSectionCommand(model.Id, model.Name, model.Description)); if (result.Status == CommandStatus.Failed) { return(Json(new { success = false, errorMsg = result.Result })); } return(Json(new { success = true })); }
public async Task <ActionResult> Update(EditSectionModel model) { if (_contextService.CurrentAccount.AccountName != "admin") { return(Json(new { success = false, errorMsg = "只有系统管理员才能修改版块。" })); } var result = await _commandService.SendAsync(new ChangeSectionNameCommand(model.Id, model.Name)); if (result.Status != AsyncTaskStatus.Success) { return(Json(new { success = false, errorMsg = result.ErrorMessage })); } return(Json(new { success = true })); }
public async Task <ActionResult> Update(EditSectionModel model) { if (_contextService.CurrentAccount.AccountName != "admin") { return(Json(new { success = false, errorMsg = "只有系统管理员才能修改版块。" })); } AsyncTaskResult <CommandResult> asyncTaskResult = await _commandService.ExecuteAsync(new ChangeSectionNameCommand(model.Id, model.Name), CommandReturnType.EventHandled); var result = asyncTaskResult.Data; if (result.Status == CommandStatus.Failed) { return(Json(new { success = false, errorMsg = result.ErrorMessage })); } return(Json(new { success = true })); }