public void Edit(Entry entry) { XElement element = getElement(entry.ID); if (element != null) { EditItem(entry, element); } else { AddItem(entry); } Update(); if (Session.AutoSave) { Save(); } }
private void AddItem(Entry entry) { Console.WriteLine("Adding item"); Entries.Element("Entries").Add(XSerializer.ToXElement(entry)); }
private void EditItem(Entry entry, XElement element) { element.ReplaceWith(XSerializer.ToXElement(entry)); }
public void Remove(Entry entry) { Entries.Element("Entries").Elements("Entry").Where(e => e.Attribute("ID").Value == entry.ID).Remove(); Update(); if (Session.AutoSave) { Save(); } }