public ActionResult Edit(ServiceReminderViewModel model) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var ServiceReminder = ServiceReminderRepository.GetServiceReminderById(model.Id); AutoMapper.Mapper.Map(model, ServiceReminder); ServiceReminder.ModifiedUserId = WebSecurity.CurrentUserId; ServiceReminder.ModifiedDate = DateTime.Now; ServiceReminderRepository.UpdateServiceReminder(ServiceReminder); 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(ServiceReminderViewModel model) { if (ModelState.IsValid) { var ServiceReminder = new ServiceReminder(); AutoMapper.Mapper.Map(model, ServiceReminder); ServiceReminder.IsDeleted = false; ServiceReminder.CreatedUserId = WebSecurity.CurrentUserId; ServiceReminder.ModifiedUserId = WebSecurity.CurrentUserId; ServiceReminder.AssignedUserId = WebSecurity.CurrentUserId; ServiceReminder.CreatedDate = DateTime.Now; ServiceReminder.ModifiedDate = DateTime.Now; ServiceReminderRepository.InsertServiceReminder(ServiceReminder); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Edit(int?Id) { var ServiceReminder = ServiceReminderRepository.GetServiceReminderById(Id.Value); if (ServiceReminder != null && ServiceReminder.IsDeleted != true) { var model = new ServiceReminderViewModel(); AutoMapper.Mapper.Map(ServiceReminder, 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 ServiceReminderViewModel(); return(View(model)); }