title: Append to a Json object in MVC controller in ASP.NET before sending data to the View
body: <p>I am building an MVC application in ASP.NET. In my Index Controller I am calling an API, get the data and pass them to the view. 
  This works well and I have no problem getting data back in my View.</p>
  
  <pre><code>public ActionResult Index()
  {
      Base model = null;
      var client = new HttpClient();
      var task =
      client.GetAsync(
      "http://example.api.com/users/john/profile")
      .ContinueWith((taskwithresponse) =&gt;
      {
          var response = taskwithresponse.Result;
          var readtask = response.Content.ReadAsAsync&lt;Base&gt;();
          readtask.Wait();
          model = readtask.Result;
  
      });
      task.Wait();
  
      return View(model);
  }
  </code></pre>
  
  <p>My Model is following:</p>
  
  <pre><code>public class Base
  {
      public Data data { get; set; }
  }
  
  public class Data
  {
      public Profile profile { get; set; }
      public Credit credit { get; set; }
  }
  
  public class Profile
  {
      public String firstname { get; set; }
      public String lastname { get; set; }
  }
  
  public class Credit
  {
      public int amount { get; set; }
  
      public string balance { get; set; }
  
  }
  </code></pre>
  
  <p>The API returns data in this format: </p>
  
  <pre><code>{
  
  "data": {
      "profile": {
          "firstname": "John,
          "lastname": "Newman",
      },
      "credit": {
          "amount": 30,
      "neverbought" : false
      }
  }
  }
  </code></pre>
  
  <p>What I want to achieve now, is to add some more properties to the returned data. For example I want to add a state property to credit, which will be calculated according to amount and neverbought properties.
  But for now let's say the credit.state will always be "lowCredit". </p>
  
  <p>So what I did, was to add Credit.state = "neverBought"; to my Controller before sending data to the View. Then I got some errors that my Credit class does not contain a definition for state. 
  I added state property to my Credit Model, but then I got "An object reference is required for the non-static field, method or property. </p>
  
  <p>Here is the code I used:</p>
  
  <pre><code>task.Wait();
  model.credit.state = "lowCredit"; 
  return View(model);
  </code></pre>
  
  <p>What am I doing wrong and what should I do to solve the problem?</p>