/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//First create a list object to hold all the items that you would like to delete deleteThese.Clear(); //If the parent has any children.... if (Parent.Child!= null) { //Cycle through all the children and add their id's to the list you built above foreach (IChild c in Parent.Child) { deleteThese.Add(c.Id.ToString()); } //Now we cycle through that list of ids... foreach (string s in deleteThese) { //First find the entity you want to delete by it's id IChild deleteMe = Sage.Platform.EntityFactory.GetById(s); //Next remove it from it's parent Parent.Cild.Remove(deleteMe); //Follow that by saving this change to the parent Parent.Save(); //Then finally deleting the entity deleteMe.Delete(); } }