internal static void AddStore(string documenPath, StoreViewModel store) { var root = XDocument.Load(documenPath).Root; root.Add(new XElement("store", new XElement("name", store.Name), new XElement("phones", null))); root.Document.Save(documenPath); }
internal static void RemoveStore(string documenPath, StoreViewModel store) { var root = XDocument.Load(documenPath).Root; foreach (var storeChild in root.Elements("store")) { if (storeChild.Element("name").Value.ToLower()==store.Name.ToLower()) { storeChild.Remove(); root.Document.Save(documenPath); break; } } }
public StoresViewModel() { this.StoresDocumentPath = "..\\..\\phones.xml"; this.newStoreViewModel = new StoreViewModel(); }