public ActionResult Create() { var organisationId = UserOrganisationId; var viewModel = new ApprovalModelViewModel { ApprovalModel = new ApprovalModel { OrganisationId = organisationId } }; return(View(viewModel)); }
public ActionResult Edit(ApprovalModelViewModel approvalModelViewModel) { if (ModelState.IsValid) { var result = HRBusinessService.UpdateApprovalModel(UserOrganisationId, approvalModelViewModel.ApprovalModel); if (result.Succeeded) { return(RedirectToAction("Edit")); } foreach (var error in result.Errors) { ModelState.AddModelError("", error); } } var viewModel = new ApprovalModelViewModel { ApprovalModel = approvalModelViewModel.ApprovalModel }; return(View(viewModel)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var approvalModel = HRBusinessService.RetrieveApprovalModel(UserOrganisationId, id.Value); if (approvalModel == null) { return(HttpNotFound()); } var viewModel = new ApprovalModelViewModel { ApprovalModel = approvalModel }; return(View(viewModel)); }