title: Return bool value from web api
body: <p>I am using Web Api 2 to create 1 user. Below is code</p>
  
  <pre><code>[HttpPost]
  public HttpResponseMessage UpdateUserData(User user)
  {                            
      try
      {
          //Code
          .
          .
          user.Update();
          return Request.CreateResponse(HttpStatusCode.OK, true);
      }
      catch (Exception ex)
      {
          ExceptionLogger.LogException(ex);
          return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "error");
      }
  }
  </code></pre>
  
  <p>I trying to call this method from code behind like </p>
  
  <pre><code>using (HttpClient client = new HttpClient())
  {
      client.BaseAddress = new Uri("http://localhost:65486/");
      client.DefaultRequestHeaders.Accept.Clear();
      client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
      var response = client.PostAsJsonAsync("api/Stock/UpdateUserData", userObject).Result;
  
      if (response.IsSuccessStatusCode)
      {
          using (HttpContent content = response.Content)
          {
              Task&lt;string&gt; result = content.ReadAsStringAsync();
              string final = result.Result;
          }  
      }
      else
      {
          //code
      }
  }
  </code></pre>
  
  <p>Now I have few queries</p>
  
  <ul>
  <li><p>Can we return Boolean value true/false in HttpResponseMessage. I mean
  in CreateErrorResponse .</p></li>
  <li><p>What is best way to check if user get updated or not ?</p></li>
  <li><p>Can this code be improved?</p></li>
  </ul>