title: How to make updates in multiple tables within many to many relationship?
body: <p>I have a many-to-many relationship and I'm trying to update two tables by one click. One is for <code>appUser</code> and the other one is for <code>userLinks</code>.</p>
  <p>My problem is I always get <code>appUser</code> data and never get <code>userLinks</code> data.</p>
  <p>The model classes:</p>
  <pre><code>public class AppUser: IdentityUser
  {
      public string Name { get; set; }
      public string Bio { get; set; }
      public List&lt;UserLink&gt; userLinks { get; set; }
  }
  
  public class UserLink
  {
      [Key]
      public Guid Id { get; set; }
      public string linkUrl { get; set; }
  
      public string UserId { get; set; }
      [ForeignKey(&quot;UserId&quot;)]
      public AppUser GetUser { get; set; }
  
      public Guid LinkId { get; set; }
      [ForeignKey(&quot;LinkId&quot;)]
      public Link GetLink { get; set; }
  }
  
  public class Link
  {
      public Guid Id { get; set; }
      public string linkIcon { get; set; }
      public string linkName { get; set; }
      public int ordr { get; set; }
      public bool IsPdf { get; set; } = false;
      public List&lt;UserLink&gt; userLinks { get; set; }
  
  }
  </code></pre>
  <p>View model:</p>
  <pre><code>public class VMUserProfile
  {
      public AppUser appUser { get; set; }
      public List&lt;UserLink&gt; userLinks { get; set; }
      public List&lt;Link&gt; links { get; set; } 
  }
  </code></pre>
  <p>View:</p>
  <pre><code>@model VMUserProfile          
  
  &lt;form asp-action=&quot;EditProfile&quot; asp-route-id=&quot;@Model.appUser.Id&quot; method=&quot;post&quot;&gt;
  ...
  &lt;ul id=&quot;linkList&quot; class=&quot;list-group&quot;&gt;
      @foreach (var item in Model.userLinks.Where(w =&gt; w.UserId == Model.appUser.Id).ToList())
      {
          &lt;li class=&quot;list-group-item&quot;&gt;
              &lt;div class=&quot;input-group&quot;&gt;
                  &lt;div class=&quot;input-group-text&quot;&gt;
                      @Html.Raw(item.GetLink.linkIcon)
                  &lt;/div&gt;
                  &lt;input asp-for=&quot;@item.linkUrl&quot; id=&quot;@item.Id&quot; class=&quot;form-control&quot; placeholder=&quot;@item.GetLink.linkName&quot; type=&quot;text&quot; /&gt;
                  &lt;div class=&quot;input-group-text&quot;&gt;
                      &lt;i class=&quot;far fa-times-circle deleteLi&quot;&gt;&lt;/i&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/li&gt;
      }
  &lt;/ul&gt;
  ...
  &lt;/form&gt;
  </code></pre>
  <p>And here are the view look and the debug result</p>
  <p><a href="https://i.stack.imgur.com/buSXW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/buSXW.png" alt="view" /></a></p>
  <p>and notice in the network section how the <code>formdata</code> contains the URLs but I never receive them in the controller action the debug result returns null</p>
  <p><a href="https://i.stack.imgur.com/jKl0S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jKl0S.png" alt="debug" /></a></p>