public ActionResult Steps(string id) { if (!Common.CheckUserSession()) { return(this.RedirectToAction("Index", "Login")); } var project = new ProjectService(Common.GetConnectionString()).Load(x => x.GUID == id).FirstOrDefault(); ViewBag.ProjectName = project.Title; ViewBag.ProjectId = project.ProjectId; ViewBag.ProjectGUID = id; var projectStepService = new ProjectStepService(Common.GetConnectionString()); ViewBag.StepIds = projectStepService.Load(x => x.ProjectId == project.ProjectId).Select(x => x.ProjectStepId).ToList(); ProjectStep firstStep = null; if (Session["ActiveStep"] != null) { int projectStepId = Convert.ToInt16(Session["ActiveStep"]); firstStep = projectStepService.Load(x => x.ProjectId == project.ProjectId && x.ProjectStepId == projectStepId).FirstOrDefault(); } if (firstStep == null) { firstStep = projectStepService.Load(x => x.ProjectId == project.ProjectId).FirstOrDefault(); } return(View(firstStep)); }
public ActionResult Steps(ProjectStepList stepList) { if (!Common.CheckUserSession()) { return(this.RedirectToAction("Index", "Login")); } var success = new ProjectStepService(Common.GetConnectionString()).SaveSteps(stepList); if (success) { return(RedirectToAction("Index")); } return(View(new { id = stepList.projectId })); }
public ActionResult StepDetail(string id) { if (!Common.CheckUserSession()) { return(this.RedirectToAction("Index", "Login")); } int projectId = Convert.ToInt16(id); var step = new ProjectStepService(Common.GetConnectionString()).Load(x => x.ProjectStepId == projectId).FirstOrDefault(); var projectName = new ProjectService(Common.GetConnectionString()).Load(x => x.ProjectId == step.ProjectId).Select(x => x.Title).SingleOrDefault(); ViewBag.ProjectName = projectName; return(View("_StepDetail", step)); }