title: Multiple entries in Cosmos DB ASP.NET MVC
body: <p>I am creating a CRUD application to add records to Cosmos DB. I have a JSON file that i use for the data. When there is only one object everything works but when my json file contains multiple objects only the last one is saved to the database. Here is my code : </p>
  
  <pre><code>[HttpPost]
      public async Task&lt;ActionResult&gt; Import(HttpPostedFileBase jsonFile, Ticket tview)
      {
          if (jsonFile == null || !Path.GetFileName(jsonFile.FileName).EndsWith(".json"))
          {
              ViewBag.Error = "Invalid file !";
          }
          else
          {
              jsonFile.SaveAs(Server.MapPath("~/JSONFiles/" + Path.GetFileName(jsonFile.FileName)));
              StreamReader streamReader = new StreamReader(Server.MapPath("~/JSONFiles/" + Path.GetFileName(jsonFile.FileName)));
              string data = streamReader.ReadToEnd();
  
              List&lt;Ticket&gt; tickets = JsonConvert.DeserializeObject&lt;List&lt;Ticket&gt;&gt;(data);
  
              tickets.ForEach(t =&gt;
              {
                  Ticket ticket = new Ticket()
                  {
                      Id = t.Id,
                      Requester = t.Requester,
                      PrjName = t.PrjName,
                      Categorie = t.Categorie,
                      ClientName = t.ClientName,
                      Service = t.Service,
                      Description = t.Description,
                      Status = t.Status
                  };
                  tview = ticket;
              });
  
              await DocumentDBRepository&lt;Ticket&gt;.CreateItemAsync(tview);
              ViewBag.Success = "Data added";
              return RedirectToAction("Index");
          }
          return View(tview);
  </code></pre>
  
  <p>I think because I should change <code>tview to List&lt;Ticket&gt;tview</code> but to save the data I use this method</p>
  
  <pre><code>public static async Task&lt;Document&gt; CreateItemAsync(T item)
      {
          return await client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId), item);
      }
  </code></pre>
  
  <p>Thank you for the help</p>