public ActionResult Edit(HistoryPointViewModel model) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var HistoryPoint = HistoryPointService.Get(model.Id); AutoMapper.Mapper.Map(model, HistoryPoint); SetModifier(HistoryPoint, true); HistoryPointService.Update(HistoryPoint); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess; if (Request["IsPopup"] != null && Request["IsPopup"].ToString().ToLower().Equals("true")) { return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" })); } return(RedirectToAction("Index")); } return(View(model)); } return(View(model)); //if (Request.UrlReferrer != null) // return Redirect(Request.UrlReferrer.AbsoluteUri); //return RedirectToAction("Index"); }
public ActionResult Create(HistoryPointViewModel model) { if (ModelState.IsValid) { var HistoryPoint = new HistoryPoint(); AutoMapper.Mapper.Map(model, HistoryPoint); SetModifier(HistoryPoint); HistoryPointService.Create(HistoryPoint); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; if (Request["IsPopup"] != null && Request["IsPopup"].ToString().ToLower().Equals("true")) { return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" })); } return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Edit(int?Id) { var HistoryPoint = HistoryPointService.Get(Id.Value); if (HistoryPoint != null && HistoryPoint.IsDeleted != true) { var model = new HistoryPointViewModel(); AutoMapper.Mapper.Map(HistoryPoint, model); if (model.CreatedUserId != Helpers.Common.CurrentUser.Id && Helpers.Common.CurrentUser.UserTypeId != 1) { TempData["FailedMessage"] = "NotOwner"; return(RedirectToAction("Index")); } return(View(model)); } if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.AbsoluteUri)); } return(RedirectToAction("Index")); }
public ViewResult Create() { var model = new HistoryPointViewModel(); return(View(model)); }