public static void AddFormOfWorkflow(Guid flowID, Guid formID) { using (var context = new BasicWebContext()) { if (context.WorkflowForms.Any(x => x.WorkflowID == flowID && x.FormID == formID)) { } else { WorkflowForm wff = new WorkflowForm(); wff.WorkflowID = flowID; wff.FormID = formID; context.WorkflowForms.Add(wff); context.SaveChanges(); } } }
public static void SetMainFormOfWorkflow(Guid flowID, Guid formID) { using (var context = new BasicWebContext()) { var record = context.WorkflowForms.FirstOrDefault(x => x.WorkflowID == flowID); if (record == null) { WorkflowForm wff = new WorkflowForm(); wff.WorkflowID = flowID; wff.FormID = formID; context.WorkflowForms.Add(wff); } else { record.FormID = formID; } context.SaveChanges(); } }