/// <summary> /// Update workflow state /// </summary> /// <param name="model"></param> /// <returns></returns> public virtual async Task <ResultModel> UpdateWorkflowStateAsync([Required] UpdateWorkFlowStateViewModel model) { if (model == null) { return(new InvalidParametersResultModel()); } var state = await _workFlowContext.States .AsNoTracking() .FirstOrDefaultAsync(x => x.Id.Equals(model.StateId)); if (state == null) { return(new NotFoundResultModel()); } state.AdditionalSettings = model.SerializeAsJson(); state.Name = model.Name; state.Description = model.Description; _workFlowContext.States.Update(state); return(await _workFlowContext.PushAsync()); }
public async Task <JsonResult> UpdateWorkFlowStateAsync([Required] UpdateWorkFlowStateViewModel model) => ModelState.IsValid ? await JsonAsync(_workFlowCreatorService.UpdateWorkflowStateAsync(model)) : Json(new InvalidParametersResultModel <object>().AttachModelState(ModelState).ToBase());