public JsonResult AddProcessRun(int processid, string name, string des) { HttpStatusCode status = HttpStatusCode.OK; string message; object response; Process process = processService.findProcess(processid); Process processrun = processService.createProcessRun(process, name, des); List <Role> role = roleService.findListRoleOfProcess(processid); List <Role> rolerun = roleService.addRoleRun(role, processrun.Id); List <Step> liststep = stepService.findStepsOfProcess(processid); List <Step> liststeprun = stepService.addStepRun(liststep, processrun.Id); foreach (Step step in liststep) { List <TaskProcess> listtask = taskService.findTaskOfStep(step.Id); taskService.addListTaskRun(listtask, rolerun, liststeprun); } message = "Created ProcessRun Successfully"; response = new { message = message, status = status }; return(Json(response, JsonRequestBehavior.AllowGet)); }