public ActionResult AddApplicantInfo([Bind(Include = "FirstName,LastName,PhoneNumber,Email")] ApplicantInfo applicantInfo) { if (ModelState.IsValid) { applicantInfo.UserAgent = HttpContext.Request.UserAgent; applicantInfo.ContentType = HttpContext.Request.ContentType; applicantInfo.IPAddress = HttpContext.Request.UserHostAddress; var val = Session["id"]; if (val == null) { if (_applicantBusiness.AddApplicantBL(applicantInfo)) { ApplicantInfo applicant = _applicantBusiness.GetRecentApplicantBL(); Session["id"] = applicant.ApplicantId; } } else { _applicantBusiness.UpdateApplicantBL(applicantInfo); } return(RedirectToAction(Constants.AddressInfo, "Address")); } return(View(Constants.ApplicantInfo)); }
public IActionResult AddApplicant([FromBody] ApplicantInfo applicantInfo) { try { bool res = _applicantBusiness.AddApplicantBL(applicantInfo); if (res) { return(StatusCode(StatusCodes.Status201Created, "Applicant added successfully")); } else { return(BadRequest(new { message = "couldnot add applicant" })); } } catch (Exception ex) { return(BadRequest(new { message = ex.Message })); } }