//Modifies the chosen estate after verifying the ID. public bool ModifyEstate(string estateID, Countries country, string city, string street, string zipCode, EstateLegalForm estateLegalForm, string estatePrice, string estateDimensions, string estateRent, string imageString) { Estate estate = null; int ID; bool IDExists = ValidateID(estateID, out ID); if (!IDExists) { return(false); } foreach (Estate compareEstate in em.getList()) { if (compareEstate.estateID == ID) { estate = compareEstate; } } estate.address.country = country; estate.estateLegalForm = estateLegalForm; //Checks which fields are entered and only modifies those. Also cathces any parsing errors. try { if (!String.IsNullOrEmpty(city)) { estate.address.city = city; } if (!String.IsNullOrEmpty(street)) { estate.address.street = street; } if (!String.IsNullOrEmpty(zipCode)) { estate.address.zipCode = zipCode; } if (!String.IsNullOrEmpty(estateDimensions)) { estate.estateDimensions = double.Parse(estateDimensions); } if (!String.IsNullOrEmpty(estateRent)) { estate.estateRent = int.Parse(estateRent); } if (!String.IsNullOrEmpty(estatePrice)) { estate.estatePrice = int.Parse(estatePrice); } if (!String.IsNullOrEmpty(imageString)) { estate.EstatePicture = imageString; } } catch (Exception e) { return(false); } SetChanged(); return(true); }