I want to know if the code below executes the next statement while waiting for the async api call? If so, then the value would be null and might cause a null exception? Am I doing this correctly?
var response = await pl_httpClient.GetAsync("api/GetInfo?CardNo=" + CardNo);
if (!response.IsSuccessStatusCode)
{
return response.StatusCode);
}
InfoModel infoModel = await response.Content.ReadAsAsync<InfoModel>();
if(infoModel == null){ return "Card number is invalid"; }
if (infoModel.ExpiryDate < DateTime.Now.Date) { return "Expired Card Number"; }
if (!infoModel.MemberStatus.Equals("1")) { return "Inactive Card Number"; }