public ActionResult Edit(int?Id) { var SalaryAdvance = SalaryAdvanceRepository.GetvwSalaryAdvanceById(Id.Value); if (SalaryAdvance != null && SalaryAdvance.IsDeleted != true) { var model = new SalaryAdvanceViewModel(); AutoMapper.Mapper.Map(SalaryAdvance, 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")); }