Пример #1
0
        public async Task <IActionResult> OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Redirect("/companies/locations/" + InputLocation.CompanyId));
            }
            Console.WriteLine(InputLocation.Country + "-----------------------" + InputLocation.CompanyId);
            await locationManager.AddLocation(InputLocation);

            return(Redirect("/companies/locations/" + InputLocation.CompanyId));
        }
Пример #2
0
        public ActionResult CreateInterview(AppointmentLocationVM appointmentLocationVM)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Location location = new Location()
                    {
                        LocationID = appointmentLocationVM.LocationID,
                        Name       = appointmentLocationVM.LocationName,
                        Address1   = appointmentLocationVM.LocationAddress1,
                        Address2   = appointmentLocationVM.LocationAddress2,
                        City       = appointmentLocationVM.LocationCity,
                        State      = appointmentLocationVM.LocationState,
                        Zip        = appointmentLocationVM.LocationZip
                    };
                    _locationManager.AddLocation(location);

                    Appointment appointment = new Appointment()
                    {
                        AppointmentID         = appointmentLocationVM.AppointmentID,
                        AdoptionApplicationID = appointmentLocationVM.AdoptionApplicationID,
                        AppointmentTypeID     = "Interview",
                        DateTime   = appointmentLocationVM.DateTime,
                        LocationID = appointmentLocationVM.LocationID
                    };
                    _appointmentManager.AddAppointment(appointment);

                    return(RedirectToAction("Index"));
                }
                catch
                {
                    return(View());
                }
            }
            return(View());
        }
        /// <summary>
        /// NAME: Austin Gee
        /// DATE: 3/21/2020
        /// CHECKED BY: Michael Thompson
        ///
        /// Saves location Details
        /// </summary>
        /// <remarks>
        /// UPDATED BY: NA
        /// UPDATE DATE: NA
        /// WHAT WAS CHANGED: NA
        ///
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSaveLocation_Click(object sender, RoutedEventArgs e)
        {
            if (!txtLocationAdress1.Text.IsValidString())
            {
                MessageBox.Show("Please enter a valid Address.");
                txtLocationAdress1.Focus();
                return;
            }
            if (!txtLocationCity.Text.IsValidString())
            {
                MessageBox.Show("Please enter a valid City.");
                txtLocationCity.Focus();
                return;
            }
            if (!txtLocationState.Text.IsValidString(2, 2))
            {
                MessageBox.Show("Please enter a valid two letter State Abreviation.");
                txtLocationState.Focus();
                return;
            }
            if (!txtLocationZip.Text.IsValidString())
            {
                MessageBox.Show("Please enter a valid Zip Code.");
                txtLocationZip.Focus();
                return;
            }

            try
            {
                var location = new Location()
                {
                    Name     = txtLocationName.Text,
                    Address1 = txtLocationAdress1.Text,
                    Address2 = txtLocationAddress2.Text,
                    City     = txtLocationCity.Text.ToUpper(),
                    State    = txtLocationState.Text,
                    Zip      = txtLocationZip.Text
                };

                _locationManager.AddLocation(location);
                MessageBox.Show("Location Added");
                populateLocationsDataGrid();
                closeLocationDetails();
            }
            catch (Exception)
            {
                throw;
            }
        }