Exemplo n.º 1
0
        public ActionResult Edit(int?Id)
        {
            var WorkingProcess = WorkingProcessRepository.GetWorkingProcessById(Id.Value);

            if (WorkingProcess != null && WorkingProcess.IsDeleted != true)
            {
                var model = new WorkingProcessViewModel();
                AutoMapper.Mapper.Map(WorkingProcess, model);
                var BonusDisciplineList = bonusDesciplineRepository.GetAllvwBonusDiscipline().Where(x => x.StaffId == model.StaffId)
                                          .Select(item => new BonusDisciplineViewModel
                {
                    Code         = item.Code,
                    Id           = item.Id,
                    Formality    = item.Formality,
                    Reason       = item.Reason,
                    DayDecision  = item.DayDecision,
                    DayEffective = item.DayEffective
                });
                ViewBag.BonusDisciplineList = BonusDisciplineList;
                //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"));
        }