Ejemplo n.º 1
0
        public ActionResult Edit(JobGradeViewModel jobGradeViewModel, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                var result = HRBusinessService.UpdateJobGrade(UserOrganisationId, jobGradeViewModel.JobGrade);
                if (result.Succeeded)
                {
                    if (string.IsNullOrEmpty(returnUrl))
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        return(Redirect(returnUrl));
                    }
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError("", error);
                }
            }
            var viewModel = new JobGradeViewModel
            {
                JobGrade = jobGradeViewModel.JobGrade
            };

            return(View(viewModel));
        }
Ejemplo n.º 2
0
        public ActionResult Create()
        {
            var organisationId = UserOrganisationId;
            var viewModel      = new JobGradeViewModel
            {
                JobGrade = new JobGrade
                {
                    OrganisationId = organisationId
                }
            };

            return(View(viewModel));
        }
Ejemplo n.º 3
0
        public ActionResult Create(JobGradeViewModel jobGradeViewModel)
        {
            if (ModelState.IsValid)
            {
                var result = HRBusinessService.CreateJobGrade(UserOrganisationId, jobGradeViewModel.JobGrade);
                if (result.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError("", error);
                }
            }
            var viewModel = new JobGradeViewModel
            {
                JobGrade = jobGradeViewModel.JobGrade
            };

            return(View(viewModel));
        }
Ejemplo n.º 4
0
        public ActionResult Edit(int?id, string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var jobGrade = HRBusinessService.RetrieveJobGrade(UserOrganisationId, id.Value);

            if (jobGrade == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new JobGradeViewModel
            {
                JobGrade = jobGrade
            };

            return(View(viewModel));
        }