public ActionResult Edit(ContractLeaseViewModel model) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var ContractLease = ContractLeaseRepository.GetContractLeaseById(model.Id); AutoMapper.Mapper.Map(model, ContractLease); ContractLease.ModifiedUserId = WebSecurity.CurrentUserId; ContractLease.ModifiedDate = DateTime.Now; ContractLeaseRepository.UpdateContractLease(ContractLease); 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(ContractLeaseViewModel model) { if (ModelState.IsValid) { var ContractLease = new ContractLease(); AutoMapper.Mapper.Map(model, ContractLease); ContractLease.IsDeleted = false; ContractLease.CreatedUserId = WebSecurity.CurrentUserId; ContractLease.ModifiedUserId = WebSecurity.CurrentUserId; ContractLease.AssignedUserId = WebSecurity.CurrentUserId; ContractLease.CreatedDate = DateTime.Now; ContractLease.ModifiedDate = DateTime.Now; ContractLeaseRepository.InsertContractLease(ContractLease); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Detail(int?Id) { var ContractLease = ContractLeaseRepository.GetContractLeaseById(Id.Value); if (ContractLease != null && ContractLease.IsDeleted != true) { var model = new ContractLeaseViewModel(); AutoMapper.Mapper.Map(ContractLease, model); if (model.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.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 ContractLeaseViewModel(); return(View(model)); }