public void Update(Core.FlowTemplate template) { var existing = _unitOfWork.FlowTemplates.Get(template.Id); if (existing == null) { throw new ValidationException(String.Format("FlowTemplate Id: {0} does not exist", template.Id)); } _unitOfWork.FlowTemplates.Update(template.Id, template); if (template.Steps != null && template.Steps.Any()) { foreach (var step in template.Steps) { var stepInstance = new Core.FlowTemplateStep { FlowTemplateId = template.Id }; if (step.IsDirty) { _unitOfWork.FlowTemplateSteps.Update(step.Id, stepInstance); } else { _unitOfWork.FlowTemplateSteps.Add(stepInstance); } } } _unitOfWork.Commit(); }
public IStep GetFlowTemplateStep(int id) { var step = _unitOfWork.FlowTemplateSteps.Get(id); if (step == null) { return(null); } var result = new Core.FlowTemplateStep { Id = step.Id, Name = step.Name, FlowTemplateId = step.FlowTemplateId, StepTypeId = step.StepTypeId }; return(result); }