public StoresViewModel() { this.Phones = new ObservableCollection<PhoneViewModel>(); this.Phones.Add(new PhoneViewModel() { }); this.newStoreViewModel = new StoreViewModel(); }
internal static void AddStore(string documenPath, string name, IEnumerable<PhoneViewModel> phones) { var storeModel = new StoreViewModel() { Name = name, Phones = phones.Select(ph => new PhoneViewModel() { Model = ph.Model, Vendor = ph.Vendor, Year = ph.Year }) }; var root = XDocument.Load(documenPath).Root; root.Add(new XElement("store", storeModel)); root.Document.Save(documenPath); }