void SaveFlat(object param) { try { ErrorVisibility = "Collapsed"; if (ValidateFlat()) { if (Flats == null) { Flats = new ObservableCollection <FlatModel>(); } Flats.Add(new FlatModel { Number = FlatNumber, ProjectId = SelectedProject.ID, Project = SelectedProject, EstimatedAmount = EstimatedAmount, AggregateAmountTotal = AggregateAmountTotal, EMI = EMI, Days = Days }); ClearFlatFields(); } } catch (Exception ex) { ErrorMessage = $"Error: {ex.Message}"; ErrorVisibility = "Visible"; } }
public void LoadData() { var res = doc.Element("root").Elements("flat").ToList(); foreach (var x in res) { Flat c = new Flat() { Region = x.Attribute("region").Value, Price = x.Attribute("price").Value, Adress = x.Attribute("adress").Value, Owner = x.Attribute("owner").Value, Phone = x.Attribute("phone").Value }; Flats.Add(c); } }
public void AddFlat(Flat flat) { Flats.Add(flat); IsDirty = false; }