c# - How to retrive id of first item of the list while adding all list elements? -


when adding list of objects model, give id of first element idparent rest of elements. how make right way?

if (item.id == 0) // insert {     long firstitemid = new long();          if (itemcc.listtitulaires.first() == item)     {         model.mar_titulaire.add(item);                   firstitemid = item.id; // item.id here 0, interested in real id model;      }     else     {         item.idparenttitulaire = firstitemid;                    model.mar_titulaire.add(item);     } } 


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -