public IActionResult GetApplicantById(int id) { try { ApplicantInfo applicantInfo = _applicantBusiness.GetApplicantByIdBL(id); if (applicantInfo == null) { return(StatusCode(StatusCodes.Status404NotFound, "Applicant with Id " + id.ToString() + " not found")); } return(Ok(applicantInfo)); } catch (Exception ex) { return(BadRequest(new { message = ex.Message })); } }
public ActionResult ApplicantInfo() { try { if (Session["id"] == null) { return(View()); } else { ApplicantInfo applicantInfo = _applicantBusiness.GetApplicantByIdBL((int)Session["id"]); return(View(applicantInfo)); } } catch (Exception ex) { return(View(Constants.ErrorView)); } }
public void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext.HttpContext.Session["id"] == null) { if (currentStage != (int)WorkflowStages.ApplicantInfo) { UrlHelper urlHelper = new UrlHelper(filterContext.RequestContext); filterContext.Result = new RedirectResult(urlHelper.Action(Constants.ApplicantInfo, "Applicant")); } } else { ApplicantInfo applicant = _applicantBusiness.GetApplicantByIdBL((int)filterContext.HttpContext.Session["id"]); highestCompletedStage = applicant.HighestCompletedStage; filterContext.HttpContext.Session["high"] = highestCompletedStage; if (minRequiredStage == highestCompletedStage) { } else if (minRequiredStage > highestCompletedStage) { UrlHelper urlHelper = new UrlHelper(filterContext.RequestContext); switch (minRequiredStage) { case 10: filterContext.Result = new RedirectResult(urlHelper.Action(Constants.ApplicantInfo, "Applicant")); break; case 20: filterContext.Result = new RedirectResult(urlHelper.Action(Constants.AddressInfo, "Address")); break; case 30: filterContext.Result = new RedirectResult(urlHelper.Action(Constants.EmploymentInfo, "Employment")); break; case 40: filterContext.Result = new RedirectResult(urlHelper.Action(Constants.MembershipInfo, "Membership")); break; } } } }