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
Post a Comment