public StepView EditStep(Step step) { //bool result = false; StepView stepView = new StepView(); if (step.Id == null || step.Name == null || step.WorkflowID == null) { stepView.StatusCode = FAILTURE; return(stepView); } else { Step ste = stepRepositories.GetOneStepById(step); if (ste == null || ste.Id == step.Id) { stepRepositories.Update(step); stepView.SetData(step); stepView.StatusCode = SUCCESS; } else { stepView.StatusCode = REPETITION; } } return(stepView); }
//search steps for workflow public ViewData <Step> GetStepsByWorkflow(Workflow workflow) { ViewData <Step> viewData = new ViewData <Step>(); if (workflow.Id != null) { Workflow result = workflowRepositories.GetOneById(workflow.Id); if (result != null && result.StepId.Count > 0) { List <Step> steps = new List <Step>(); foreach (String stepid in result.StepId) { if (stepid != null) { Step stepinput = new Step(); stepinput.Id = stepid; Step steptemp = stepRepositories.GetOneStepById(stepinput); if (steptemp != null) { steps.Add(steptemp); } } } viewData.StatusCode = SUCCESS; viewData.SetData(steps); } } viewData.StatusCode = FAIL; return(viewData); }