public ActionResult Create(ProcessStepViewModel model, bool IsPopup) { if (ModelState.IsValid) { var ProcessStep = new ProcessStep(); AutoMapper.Mapper.Map(model, ProcessStep); ProcessStep.IsDeleted = false; ProcessStep.CreatedUserId = WebSecurity.CurrentUserId; ProcessStep.ModifiedUserId = WebSecurity.CurrentUserId; ProcessStep.AssignedUserId = WebSecurity.CurrentUserId; ProcessStep.CreatedDate = DateTime.Now; ProcessStep.ModifiedDate = DateTime.Now; ProcessStepRepository.InsertProcessStep(ProcessStep); if (IsPopup) { return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" })); } else { TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; return(RedirectToAction("Index")); } } return(View(model)); }
public ActionResult Edit(ProcessStepViewModel model, bool IsPopup) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var ProcessStep = ProcessStepRepository.GetProcessStepById(model.Id); AutoMapper.Mapper.Map(model, ProcessStep); ProcessStep.ModifiedUserId = WebSecurity.CurrentUserId; ProcessStep.ModifiedDate = DateTime.Now; ProcessStepRepository.UpdateProcessStep(ProcessStep); if (IsPopup) { return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" })); } else { TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; return(RedirectToAction("Index")); } } return(View(model)); } return(View(model)); //if (Request.UrlReferrer != null) // return Redirect(Request.UrlReferrer.AbsoluteUri); //return RedirectToAction("Index"); }
public ActionResult Edit(int?Id, string ProcessEntity) { var ProcessStep = ProcessStepRepository.GetProcessStepById(Id.Value); if (ProcessStep != null && ProcessStep.IsDeleted != true) { var model = new ProcessStepViewModel(); AutoMapper.Mapper.Map(ProcessStep, model); if (model.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId != 1) { TempData["FailedMessage"] = "NotOwner"; return(RedirectToAction("Index")); } model.ProcessEntity = ProcessEntity; return(View(model)); } if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.AbsoluteUri)); } return(RedirectToAction("Index")); }
public ViewResult Create(int StageId, string ProcessEntity) { var model = new ProcessStepViewModel(); model.StageId = StageId; model.ProcessEntity = ProcessEntity; return(View(model)); }