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); }
public StepView GetAllSteps() { StepView stepView = new StepView(); List <Step> steps = stepRepositories.GetAllStep(); stepView.StatusCode = SUCCESS; stepView.SetData(steps); return(stepView); }
public StepView GetOneStepById(Step step) { StepView stepview = new StepView(); if (step.Id == null) { stepview.StatusCode = FAILTURE; } else { stepRepositories.GetOneStepById(step); stepview.StatusCode = SUCCESS; stepview.SetData(step); } //stepview = FAILTURE; return(stepview); }
public StepView GetStepsByWorkflowId(Step step) { StepView stepView = new StepView(); if (step.WorkflowID == null) { stepView.StatusCode = FAILTURE; } else { List <Step> list = new List <Step>(); list = stepRepositories.GetStepsByWorkflowId(step.Id); stepView.StatusCode = SUCCESS; stepView.SetData(list); } //throw new NotImplementedException(); return(stepView); }
public StepView AddStep(Step step) { // bool result = false; StepView stepView = new StepView(); // workflowRepositories.GetOne(step); if (step.Name == null || step.WorkflowID == null || step.WorkflowID == "") { stepView.StatusCode = FAILTURE; //stepView.Data = step; return(stepView); } else { Step searchstep = stepRepositories.GetOneStepByNameAndWorkflowId(step); // Step searchstep = stepRepositories.GetOneStepByName(step); if (searchstep == null) { bool result = stepRepositories.CreateStep(step); if (result) { Step returnstep = stepRepositories.GetOneStepByNameAndWorkflowId(step); if (returnstep != null) { stepView.SetData(returnstep); stepView.StatusCode = SUCCESS; return(stepView); } } // stepView.Data = step; } else { stepView.StatusCode = REPETITION; return(stepView); } } stepView.StatusCode = FAILTURE; return(stepView); }