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)); }
public ActionResult Create() { var organisationId = UserOrganisationId; var viewModel = new JobGradeViewModel { JobGrade = new JobGrade { OrganisationId = organisationId } }; return(View(viewModel)); }
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)); }
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)); }