示例#1
0
        public async Task <ActionResult <Passenger> > Delete(string id)
        {
            var passenger = _passengerService.Get(id);

            if (passenger == null)
            {
                return(NotFound());
            }

            await _passengerService.Delete(passenger.Id);

            return(_passengerService.Get(id, true));
        }
        public async Task TestDelete()
        {
            await TestCreate();

            await _passengerService.Delete(_testPassenger.Id);

            var actualDisabled = _passengerService.Get(_testPassenger.Id, true);

            Assert.AreEqual(actualDisabled.Enabled, false);

            var actual = _passengerService.Get(_testPassenger.Id);

            Assert.AreEqual(null, actual);
        }
示例#3
0
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (loginService.IsSuperUser)
            {
                if (MessageBox.Show("Are you sure to delete this passengers?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes)
                {
                    passengerService.Delete(LstPassengers.SelectedIndex);

                    for (int i = 0; i < passengerService.GetPassengers().Count; i++)
                    {
                        passengerService.GetPassengers()[i].ID = i;
                    }

                    RefreshList();
                }
            }
            else
            {
                MessageBox.Show("Access Denied", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }