Ejemplo n.º 1
0
 public StoresViewModel()
 {
     this.Phones = new ObservableCollection<PhoneViewModel>();
     this.Phones.Add(new PhoneViewModel()
     {
         
     });
     this.newStoreViewModel = new StoreViewModel();
 }
Ejemplo n.º 2
0
        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);
        }