/// <summary>
        /// Alissa Duffy
        /// Updated: 2017/04/24
        ///
        /// Adds New Location.
        /// Standardized Methods.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddLocation_Click(object sender, RoutedEventArgs e)
        {
            if (txtDescription.Text.Equals(""))
            {
                MessageBox.Show("Please enter a description!");
                return;
            }

            Location location = new Location()
            {
                Description = txtDescription.Text,
                IsActive    = (bool)chkActive.IsChecked
            };

            try
            {
                if (_locationMgr.CreateLocation(location) == 1)
                {
                    MessageBox.Show("Location successfully created.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to create location. Error Message: " + ex.Message);
            }
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("LocationId,Name,Address,City,State,Phone")] Location location)
        {
            if (ModelState.IsValid)
            {
                await _context.CreateLocation(location);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }
Пример #3
0
 public Task CreateLocation([FromBody] Location location)
 {
     return(_locationManager.CreateLocation(location));
 }