public JsonResult VerifyIdNumber(string idnumber) { SouthAfricanIDService.SouthAfricanIdServiceClient client = new SouthAfricanIDService.SouthAfricanIdServiceClient(); bool result = client.VerifySouthAfricanId(idnumber); if(result == true) { return Json(new { Success = true, Result = "The Id number is valid." }, JsonRequestBehavior.AllowGet); } else { return Json(new { Success = true, Result = "The Id number is not valid." }, JsonRequestBehavior.AllowGet); } }
public JsonResult GenerateNewId(string dob, string gender) { try { string year = dob.Substring(2, 2); string month = dob.Substring(5, 2); string day = dob.Substring(8, 2); SouthAfricanIDService.SouthAfricanIdServiceClient client = new SouthAfricanIDService.SouthAfricanIdServiceClient(); string retData = client.GenerateSouthAfricanId(day, month, year, gender); return Json(new { Success = true, Result = retData }, JsonRequestBehavior.AllowGet); } catch(Exception ex) { //TODO add error logging return Json(new { Success = true, Result = "Error!" }, JsonRequestBehavior.AllowGet); } }