/// <summary> /// Cleater out all properties and also reset the list /// </summary> private void ClearEstate() { EstatePropertiesBusiness epBusiness = new EstatePropertiesBusiness(); _epBusiness = epBusiness; _estateProperties = new ObservableCollection <EstateProperties>(epBusiness.AllEstateProperties()); OnPropertyChanged("EstateProperties"); GetDollarAmount(); _workingProperty = new EstateProperties() { Address = "", City = "", Zipcode = 0, Price = 0, Bedrooms = 0, Bathrooms = 0, Fireplace = false, Pool = false, Comment = "", Description = "", SqrFeet = 0, State = "" }; OnPropertyChanged("WorkingProperty"); DeleteVisible = false; UpdateVisible = false; AddVisible = true; _errors.Clear(); }
/// <summary> /// View the properties of the selected Estate /// </summary> /// private void ViewEstate() { _errors.Clear(); if (_selectedProperty != null) { _workingProperty = new EstateProperties(); _workingProperty.Address = _selectedProperty.Address; _workingProperty.Bathrooms = _selectedProperty.Bathrooms; _workingProperty.Bedrooms = _selectedProperty.Bedrooms; _workingProperty.City = _selectedProperty.City; _workingProperty.Comment = _selectedProperty.Comment; _workingProperty.Description = _selectedProperty.Description; _workingProperty.Fireplace = _selectedProperty.Fireplace; _workingProperty.Id = _selectedProperty.Id; _workingProperty.Pool = _selectedProperty.Pool; _workingProperty.Price = _selectedProperty.Price; _workingProperty.SqrFeet = _selectedProperty.SqrFeet; _workingProperty.State = _selectedProperty.State; _workingProperty.Zipcode = _selectedProperty.Zipcode; OnPropertyChanged("WorkingProperty"); DeleteVisible = true; UpdateVisible = true; AddVisible = false; } }
public void Delete(EstateProperties estate) { try { _dataService.DeleteEstate(Table, estate.Id, estate); _estatProperties.Remove(estate); } catch (Exception) { throw; } }
public void Add(EstateProperties estate) { try { _estatProperties.Add(estate); _dataService.InsertEstate(Table, estate); } catch (Exception) { throw; } }
/// <summary> /// Update Entry to Database /// </summary> /// <typeparam name="T"></typeparam> /// <param name="table"></param> /// <param name="id"></param> /// <param name="Record"></param> /// <param name="estate"></param> public void UpdateEstate <T>(string table, Guid id, T Record, EstateProperties estate) { var collection = db.GetCollection <T>(table); var filter = Builders <T> .Filter.Eq("_id", id); var update = Builders <T> .Update.Set("Address", estate.Address) .Set("City", estate.City).Set("State", estate.State).Set("Zipcode", estate.Zipcode).Set("Price", estate.Price) .Set("Bathrooms", estate.Bathrooms).Set("Bedrooms", estate.Bedrooms).Set("Pool", estate.Pool).Set("SqrFeet", estate.SqrFeet) .Set("Comment", estate.Comment).Set("Description", estate.Description).Set("Fireplace", estate.Fireplace); collection.UpdateOne(filter, update); }
public void UpdateEstateProperty(EstateProperties estate) { try { using (EstatePropertiesRepository epRepository = new EstatePropertiesRepository()) { epRepository.Update(estate); } } catch (Exception) { throw; } }
public MainViewModel(EstatePropertiesBusiness epBusiness) { //db = new MongoCRUD("PropertyDB"); _epBusiness = epBusiness; _estateProperties = new ObservableCollection <EstateProperties>(epBusiness.AllEstateProperties()); GetDollarAmount(); _selectedProperty = new EstateProperties(); _workingProperty = new EstateProperties(); _errors = new ObservableCollection <string>(); AddVisible = true; SortList = new ObservableCollection <string>() { "Price", "City", "Zip", "Bedrooms", "SqrFeet", "State" }; }