public ActionResult Edit(FlowStepViewModel model, string ReturnUrl) { ActionResult action; try { if (!base.ModelState.IsValid) { base.ModelState.AddModelError("", MessageUI.ErrorMessage); return(base.View(model)); } else { FlowStep byId = this._flowStepService.Get((FlowStep x) => x.Id == model.Id, false); string titleNonAccent = model.Title.NonAccent(); if (model.Image != null && model.Image.ContentLength > 0) { string fileExtension = Path.GetExtension(model.Image.FileName); string fileName1 = titleNonAccent.FileNameFormat(fileExtension); // int? nullable = null; //int? nullable1 = nullable; //nullable = null; this._imagePlugin.CropAndResizeImage(model.Image, string.Format("{0}", Contains.FlowStepFolder), fileName1, ImageSize.FlowStep_WithMediumSize, ImageSize.FlowStep_HeightMediumSize, false); model.ImageUrl = string.Concat(Contains.FlowStepFolder, fileName1); } FlowStep flowStep1 = Mapper.Map(model, byId); _flowStepService.Update(flowStep1); base.Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.FlowStep))); if (!base.Url.IsLocalUrl(ReturnUrl) || ReturnUrl.Length <= 1 || !ReturnUrl.StartsWith("/") || ReturnUrl.StartsWith("//") || ReturnUrl.StartsWith("/\\")) { action = base.RedirectToAction("Index"); } else { action = this.Redirect(ReturnUrl); } } } catch (Exception exception1) { Exception exception = exception1; base.ModelState.AddModelError("", exception.Message); ExtentionUtils.Log(string.Concat("Post.Edit: ", exception.Message)); return(base.View(model)); } return(action); }
public ActionResult Edit(FlowStepViewModel postView, string ReturnUrl) { ActionResult action; try { if (!base.ModelState.IsValid) { base.ModelState.AddModelError("", MessageUI.ErrorMessage); return(base.View(postView)); } else { FlowStep flowStep = this._flowStepService.Get((FlowStep x) => x.Id == postView.Id, false); string str = postView.Title.NonAccent(); if (postView.Image != null && postView.Image.ContentLength > 0) { string str1 = string.Concat(str, ".jpg"); int? nullable = null; int? nullable1 = nullable; nullable = null; this._imagePlugin.CropAndResizeImage(postView.Image, string.Format("{0}", Contains.PostFolder), str1, nullable1, nullable, false); postView.ImageUrl = string.Concat(Contains.PostFolder, str1); } FlowStep flowStep1 = Mapper.Map <FlowStepViewModel, FlowStep>(postView, flowStep); this._flowStepService.Update(flowStep1); base.Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.FlowStep))); if (!base.Url.IsLocalUrl(ReturnUrl) || ReturnUrl.Length <= 1 || !ReturnUrl.StartsWith("/") || ReturnUrl.StartsWith("//") || ReturnUrl.StartsWith("/\\")) { action = base.RedirectToAction("Index"); } else { action = this.Redirect(ReturnUrl); } } } catch (Exception exception1) { Exception exception = exception1; base.ModelState.AddModelError("", exception.Message); ExtentionUtils.Log(string.Concat("Post.Edit: ", exception.Message)); return(base.View(postView)); } return(action); }
public ActionResult Edit(int Id) { FlowStepViewModel flowStepViewModel = Mapper.Map <FlowStep, FlowStepViewModel>(this._flowStepService.Get((FlowStep x) => x.Id == Id, false)); return(base.View(flowStepViewModel)); }