Exemplo n.º 1
0
        public bool RemoveMother(int id)
        {
            XElement NannyElement;

            try
            {
                NannyElement = (from p in MotherRoot.Elements()
                                where Convert.ToInt32(p.Element("id").Value) == id
                                select p).FirstOrDefault();
                NannyElement.Remove();
                MotherRoot.Save(MotherPath);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        public void DeleteNanny(uint nannyId)
        {
            XElement NannyElement;

            NannyElement = (from item in NannysFile.Elements()
                            where uint.Parse(item.Element("Id").Value) == nannyId
                            select item).FirstOrDefault();

            if (NannyElement == null)
            {
                throw new IdException
                      {
                          Message = "A nanny with this id does not exist in the system."
                      }
            }
            ;

            NannyElement.Remove();
            NannysFile.Save(NannysPath);
        }