Exemple #1
0
        public void Edit(Entry entry)
        {
            XElement element = getElement(entry.ID);
            if (element != null)
            {
                EditItem(entry, element);
            }
            else
            {
                AddItem(entry);
            }

            Update();
            if (Session.AutoSave)
            {
                Save();
            }
        }
Exemple #2
0
 private void AddItem(Entry entry)
 {
     Console.WriteLine("Adding item");
     Entries.Element("Entries").Add(XSerializer.ToXElement(entry));
 }
Exemple #3
0
 private void EditItem(Entry entry, XElement element)
 {
     element.ReplaceWith(XSerializer.ToXElement(entry));
 }
Exemple #4
0
        public void Remove(Entry entry)
        {
            Entries.Element("Entries").Elements("Entry").Where(e => e.Attribute("ID").Value == entry.ID).Remove();

            Update();
            if (Session.AutoSave)
            {
                Save();
            }
        }