public ActionResult Edit(CarLineViewModel model) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var CarLine = CarLineService.Get(model.Id); AutoMapper.Mapper.Map(model, CarLine); SetModifier(CarLine, true); CarLineService.Update(CarLine); 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(CarLineViewModel model) { if (ModelState.IsValid) { var CarLine = new CarLine(); AutoMapper.Mapper.Map(model, CarLine); SetModifier(CarLine); CarLineService.Create(CarLine); 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 CarLine = CarLineService.Get(Id.Value); if (CarLine != null && CarLine.IsDeleted != true) { var model = new CarLineViewModel(); AutoMapper.Mapper.Map(CarLine, 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 CarLineViewModel(); return(View(model)); }