title: How to delete multiple items in MVC with a single link?
body: <p>Consider following:</p>
  
  <p>Partial View:</p>
  
  <pre><code>&lt;%= Html.ListBox("BlackList", Model.Select(
                      x =&gt; new SelectListItem
                               {
                                     Text = x.Word, 
                                     Value = x.ID.ToString(), 
                                     Selected = Model.Any(y=&gt; y.ID == x.ID)
                               }))%&gt;
  </code></pre>
  
  <p>Main View:</p>
  
  <pre><code> &lt;td&gt;&lt;% Html.RenderPartial("GetBlackList", ViewData["BlackList"]); %&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>        [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult DeleteWord(int[] wordIdsToDelete)
      {
          if (!ModelState.IsValid)
             return View();
          try
          {
              _wordManager.DeleteWord(wordIdsToDelete);
            return RedirectToAction("WordList");
          }
          catch
          {
              return View();
          }
      }
  </code></pre>
  
  <p>Model (WordManager)</p>
  
  <pre><code>    public void DeleteWord(int[] idsToDelete)
      {
          var dataContext = GetLinqContext();
          var currentList = GetTabooWordList();
  
          foreach (var id in idsToDelete)
          {
              foreach (var item in currentList)
              {
                  if (item.ID == id)
                  {
                         dataContext.BadWords.DeleteOnSubmit(item);
                  }
              }
          }
          dataContext.SubmitChanges();
      }
  </code></pre>
  
  <p><strong>The question is how correctly pass the parameter - idsForDel ?</strong>
  I.E I have to pass a client data to the server? </p>
  
  <pre><code>   &lt;%= Html.ActionLink("Delete Selected", "DeleteWord", "AdminWord", new { wordIds = idsForDel })%&gt;
  </code></pre>
  
  <p>I think this can be made by jQuery. Any ideas?</p>