title: Save a List of object in ASP.NET MVC
body: <p>I have a question about Saving a list of object in ASP.NET MVC.
  First I'm not using EntityFramework or Nh like ORM tool, just use Ado.net</p>
  
  <p>suppose I have an object Product, and I want to collect all the products data via javascript and batch update the product list in one call.</p>
  
  <p>my question is  when should I differentiate which item is inserted, updated, or deleted? </p>
  
  <ol>
  <li><p>one strategy is that I have a enum property on the DTO object and
  also on the javascript ViewModel, and when I add an item into the
  viewModel, I marked this object to add, and if I changed one Item, I
  marked it to updated. so when this request come to the action, I can
  know which items to be insert or update.</p>
  
  <ul>
  <li>pros: it's easy on server side, don't need to differentiate the    object status from server side. </li>
  <li>cons: if I want to publish this action to webapi that will be called by third party, that may need third party user to
  differentiate the state of the object.</li>
  </ul></li>
  <li><p>differentiate the data from server side, just give me a list of object, on the server side, first retrive the current data from database, compare the data, then check which record to be inserted or updated.</p>
  
  <ul>
  <li>pros: all the compare are done from server side.</li>
  <li>cons: proformance issue</li>
  </ul></li>
  <li><p>what ever the data passed from client, just remove the current data and insert the new data</p></li>
  </ol>
  
  <p>I hope someone could give me an advice, what's the best practice to handle this situation, I think it's quite common but I can't find a best solution.</p>