Exemplo n.º 1
0
        private void ApplyBtn_Click(object sender, RoutedEventArgs e)
        {
            var validator = Validate();

            if (validator)
            {
                property property = new property
                {
                    property_name   = formName.Text,
                    address         = formAddress.Text,
                    city            = formCity.Text,
                    province        = formProvince.Text,
                    country         = formCountry.Text,
                    postal_code     = formPostal.Text,
                    number_of_units = int.Parse(formNumberOfUnits.Text),
                    available_space = int.Parse(formAvailableSpace.Text),
                    rentable_area   = int.Parse(formRentableArea.Text),
                    parking_spots   = formParkingSpots.Text
                };

                _propertyAccess.AddProperty(property);

                Close();

                MessageBoxButton mbBtn   = MessageBoxButton.OK;
                string           header  = "Add Property";
                string           message = $"Property: {property.property_name} has been created.";
                MessageBoxImage  icon    = MessageBoxImage.Information;
                MessageBoxResult result  = MessageBox.Show(message, header, mbBtn, icon);
            }
        }