title: Get & Post in ASP.NET Blazor
body: <p>With the help of a few samples available on the internet, I am able to develop a ASP.NET Core Hosted Blazor Application.</p>
  
  <p>But While Calling an api as follow</p>
  
  <pre><code> private async Task Refresh()
  {
      li.Clear();
      li = await Http.GetJsonAsync&lt;SampleModel[]&gt;("/api/Sample/GetList");
      StateHasChanged();
  }
  
  private async Task Save()
  {  
     await Http.SendJsonAsync(HttpMethod.Post, "api/Sample/Add", obj);     
     await Refresh();
  }
  </code></pre>
  
  <p>In the line below:</p>
  
  <pre><code>await Http.SendJsonAsync(HttpMethod.Post, "api/Sample/Add", obj);     
  </code></pre>
  
  <p>How can I check status code of this HTTP call?</p>
  
  <p>If there occurs any problem in API call than I want to display a message.</p>
  
  <p>But when I do:</p>
  
  <pre><code> HttpResponseMessage resp = await Http.SendJsonAsync(HttpMethod.Post, "api/Sample/Add", obj);
  </code></pre>
  
  <p>Then it says:</p>
  
  <blockquote>
    <p>can not cast void to <code>HttpResponse</code> Message</p>
  </blockquote>
  
  <p>I am using below methods:</p>
  
  <pre><code>GetJsonAsync() // For HttpGet
  SendJsonAsync() // For HttpPost And Put
  DeleteAsync() // For HttpDelete  
  </code></pre>
  
  <p>How can I verify the status code here ?</p>