title: How to fill List C# with data json from API in Blazor?
body: <p>How to fill this list <code>protected List&lt;ItemModel&gt; ItemList = new List&lt;ItemModel&gt;();</code> 
  with data json from API in blazor </p>
  
  <p>This is the Json data</p>
  
  <pre><code>[
      {
          "id":1,
          "itemName":"ROUTER MI C3",
          "idItemBrand":1,
          "idItemGroup":1,
          "dateCreated":"2019-12-26T00:00:00",
          "dateModified":"2019-12-26T00:00:00",
          "idUserModified":"1"
      }
  ]
  </code></pre>
  
  <p>this is the complete code</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Threading.Tasks;
  using Inventory.General;
  using Inventory.Model.Master;
  using Inventory.Client.Components.Base;
  using Microsoft.AspNetCore.Components;
  
  namespace Inventory.Client.Components.Master
  {
      public class MasterDataBase : InventoryComponentBase
      {
          protected string error { get; set; }
          protected bool TableItem { get; set; } = true;
          protected bool TableItemBrand { get; set; } = false;
          protected bool TableItemGroup { get; set; } = false;
          protected int BtnTable { get; set; } = 0;
          protected List&lt;ItemModel&gt; ItemList = new List&lt;ItemModel&gt;();
  
          protected override async Task OnInitializedAsync()
          {
              GetDataItem();
          }
  
          protected async Task GetDataItem()
          {
              try
              {
                  ItemList = await Http.GetJsonAsync&lt;ItemModel&gt;("api/inventory/v1/item");
              }
              catch (Exception ex)
              {
  
                  error = ex.Message;
              }
          }
      }
  }
  </code></pre>
  
  <p>This is the ItemModel Class</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel.DataAnnotations;
  using System.ComponentModel.DataAnnotations.Schema;
  using System.Text;
  
  namespace Inventory.Model.Master
  {
      public class ItemModel
      {
          [Key]
          [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
          public int Id { get; set; }
          public string ItemName { get; set; }
          public int IdItemBrand { get; set; }
          public int IdItemGroup { get; set; }
          public DateTime DateCreated { get; set; }
          public DateTime DateModified { get; set; }
          public string IdUserModified { get; set; }
      }
  }
  </code></pre>