Esempio n. 1
0
        async void Delete()
        {
            await _flightService.Delete(Flight.Id);

            Flight = new Flight();
            await LoadFlights().ConfigureAwait(false);
        }
Esempio n. 2
0
        async void Delete()
        {
            await flightservice.Delete(Flight.Id);

            Flight = new Flight();
            await LoadEntity().ConfigureAwait(false);
        }
Esempio n. 3
0
 public ActionResult <Flight> Delete(int id)
 {
     try
     {
         return(Ok(_service.Delete(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Esempio n. 4
0
        public async Task Delete()
        {
            await flightService.Delete(Flight.Id);

            Flight = new Flight();
            NotifyPropertyChanged(() => Flight);
            List <Flight> tempFlights = await flightService.GetAll();

            Flights = new ObservableCollection <Flight>();
            foreach (var fl in tempFlights)
            {
                Flights.Add(fl);
            }
            NotifyPropertyChanged(() => Flights);
        }
Esempio n. 5
0
        public async Task CreateFlight_WhenFlightValid_ReturnNewFlight()
        {
            FlightDto flight = new FlightDto()
            {
                ArrivalPoint   = "Test",
                DeparturePoint = "Test",
                ArrivalTime    = new TimeSpan(),
                DepartureTime  = new TimeSpan(),
                Tickets        = new List <TicketDto>()
            };
            FlightDto flightDtoSaved = await serviceFlight.Create(flight);

            Assert.AreEqual(flight.ArrivalPoint, flight.ArrivalPoint);
            Assert.AreEqual(flight.DeparturePoint, flight.DeparturePoint);

            bool result = await serviceFlight.Delete <Aircraft>(aircr => aircr.Id == flightDtoSaved.Id);

            Assert.IsTrue(result);
        }
Esempio n. 6
0
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (loginService.IsSuperUser)
            {
                if (MessageBox.Show("Are you sure to delete this flight?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes)
                {
                    flightService.Delete(LstFlights.SelectedIndex);

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

                    RefreshList();
                }
            }
            else
            {
                MessageBox.Show("Access Denied", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        public async Task DeleteById(int id)
        {
            await fs.Delete(id);

            this.Frame.Navigate(typeof(Flights));
        }
 public void Delete(int id)
 {
     flightService.Delete(id);
 }