public async Task <JsonResult> CheckInfo(AccountCheckInfo checkInfo) { try { if (!ModelState.IsValid) { throw new HttpException((int)HttpStatusCode.BadRequest, ConstantHelper.KEY_IN_REQUIRED_FIELD); } Response.StatusCode = 200; var account = await handler.CheckPhoneNumber(checkInfo); if (account == null) { return(Json("", JsonRequestBehavior.AllowGet)); } return(Json(account.acct_AccountID, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { if (ex.Message == ConstantHelper.ALREADY_REQUEST_LOAN || ex.Message == ConstantHelper.KEY_IN_REQUIRED_FIELD) { Response.StatusCode = 400; } else { Response.StatusCode = 500; } return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } }
public async Task <IHttpActionResult> CheckPhoneNumber([FromUri] string phoneNumber) { var record = await handler.CheckPhoneNumber(phoneNumber); if (record == null) { return(NotFound()); } else { return(Ok(record)); } }