public bool SaveSteps(ProjectStepList steps) { var projectName = new ProjectService(ConnectionString).Load(x => x.ProjectId == steps.projectId).Select(x => x.Title).FirstOrDefault().Replace(" ", "_"); int stepNo = 1; try { foreach (var step in steps.projectStepList) { string fileName = "Step" + stepNo.ToString() + "_" + step.Title + "." + step.uploadStepImage.FileName.Split('.')[1]; fileName = fileName.Replace(" ", "_"); string path = Common.GetAppSettingValue("ProjectFilePath"); path = Path.Combine(HttpContext.Current.Server.MapPath(path), projectName); Common.UploadFile1(step.uploadStepImage, path, fileName, "Project", false); step.ImageName = fileName; step.Step = stepNo; AddStep(step, steps.projectId); stepNo += 1; } return(true); } catch { return(false); } }
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 })); }