send custom error status code with JArray
<p>I have webapi, that return JArray.
There is any way to send response with some status code that I pick (like 422, 4XX )? </p>

<pre><code>        //GET api/UserControl/GetUserName
    public JArray GetUserName()
    {
        JArray json = new JArray();
        try
        {
            string UserID= getUserID();
            if (!string.IsNullOrEmpty(UserID) || UserID== "None Was found")
            {
                var result = JsonConvert.SerializeObject(donorRep.GetUserFullName(UserID), Formatting.None,
                  new JsonSerializerSettings()
                  {
                      ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                  });
                try
                {
                    json = JArray.Parse(result);
                }
                catch
                {
                    json.Add(result.ToString());
                }
            }
            else
            {
                json.Add("There was an issue while retrieving your UserID.");
            }
        }
        catch (JsonSerializationException ex)
        {
            json.Add("There was an issue while retrieving your IDSID. Please contact support");
        }
        return json;
    }
</code></pre>

<p>for example if there is an error here  than in the UI :</p>

<pre><code> json.Add("There was an issue while retrieving your UserID");
</code></pre>