public ActionResult Edit(LogServiceRemminderViewModel model) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var LogServiceRemminder = LogServiceRemminderRepository.GetLogServiceRemminderById(model.Id); AutoMapper.Mapper.Map(model, LogServiceRemminder); LogServiceRemminder.ModifiedUserId = WebSecurity.CurrentUserId; LogServiceRemminder.ModifiedDate = DateTime.Now; LogServiceRemminderRepository.UpdateLogServiceRemminder(LogServiceRemminder); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess; return(RedirectToAction("Index")); } return(View(model)); } return(View(model)); //if (Request.UrlReferrer != null) // return Redirect(Request.UrlReferrer.AbsoluteUri); //return RedirectToAction("Index"); }
public ActionResult Create(LogServiceRemminderViewModel model) { if (ModelState.IsValid) { var LogServiceRemminder = new LogServiceRemminder(); AutoMapper.Mapper.Map(model, LogServiceRemminder); LogServiceRemminder.IsDeleted = false; LogServiceRemminder.CreatedUserId = WebSecurity.CurrentUserId; LogServiceRemminder.ModifiedUserId = WebSecurity.CurrentUserId; LogServiceRemminder.AssignedUserId = WebSecurity.CurrentUserId; LogServiceRemminder.CreatedDate = DateTime.Now; LogServiceRemminder.ModifiedDate = DateTime.Now; LogServiceRemminderRepository.InsertLogServiceRemminder(LogServiceRemminder); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Edit(int?Id) { var LogServiceRemminder = LogServiceRemminderRepository.GetLogServiceRemminderById(Id.Value); if (LogServiceRemminder != null && LogServiceRemminder.IsDeleted != true) { var model = new LogServiceRemminderViewModel(); AutoMapper.Mapper.Map(LogServiceRemminder, 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 LogServiceRemminderViewModel(); return(View(model)); }