Esempio n. 1
0
        /// <summary>
        /// This Function delete a child
        /// </summary>
        /// <param name="c"></param>
        public void deleteChild(Child c)
        {
            XElement ChildElement;

            try
            {
                ChildElement = (from p in ChildRoot.Elements()
                                where Convert.ToInt32(p.Element("id").Value) == c.id
                                select p).FirstOrDefault();
                ChildElement.Remove();
                ChildRoot.Save(ChildPath);
            }
            catch
            {
                new Exception("The Child you tried to remove wasnt exist");
            }
        }
Esempio n. 2
0
        public bool RemoveChild(int id)
        {
            XElement ChildElement;

            try
            {
                ChildElement = (from p in ChildRoot.Elements()
                                where Convert.ToInt32(p.Element("id").Value) == id
                                select p).FirstOrDefault();
                ChildElement.Remove();
                ChildRoot.Save(ChildPath);
                return(true);
            }
            catch
            {
                return(false);
            }
        }