title: how to use ajax.beginform with foreach and model to create button for each li inside a partialview ul list? (the buttons are there to remove items/li)
body: <p>I am creating an mvc project and in it I am using foreachinside a partial view to fill an ul list in the view . My foreach collection is a list of model and I want to create a button for each model/li element that submits the current model to a PartialViewResult which then will delete the model from databse. So I try something like this:</p>
  
  <pre><code>@model WebApplication6.Models.Lang_User
  @{ WebApplication6.Models.Entities db = new WebApplication6.Models.Entities();
   List&lt;WebApplication6.Models.Lang_User&gt; langlist=db.Lang_User.Where(x =&gt; x.UserID ==Model.UserID).ToList();
      }
  { 
  @foreach (WebApplication6.Models.Lang_User item in langlist)
  {using (Ajax.BeginForm("DilSil", new AjaxOptions())) {
  
  
      &lt;li id="@item.ID" class="list-group-item"&gt;@item.Languages.Language &lt;button type="submit" class="btn btn-warning"&gt;&lt;/button&gt;&lt;/li&gt;
      }
  }
  </code></pre>
  
  <p>But now i need to make something inside ajaxforms. When i submit one of the forms in ul list. It must submit the @item so is there a way to do it? </p>
  
  <p>edit1: Delete PartialViewResult</p>
  
  <pre><code> public PartialViewResult DilSil(Lang_User dil)
          {
              db.Lang_User.Remove(dil);
              db.SaveChanges();
              System.Threading.Thread.Sleep(3000);
              return PartialView("_DilPartial", dil);
          }
  </code></pre>