public async Task <IActionResult> Edit(int id, [Bind("Id,ConfirmationNumber,Airline,FlightNumber,DepartureDate,DepartureTime,DepartureFrom,DepartureTerminal,DepartureGate,ArrivalDate,ArrivalTime,ArrivalTo,ArrivalTerminal,ArrivalGate,Seats,TripId")] Flight flight)
        {
            if (id != flight.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(flight);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FlightExists(flight.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Details", new { flight.Id }));
            }
            return(View(flight));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Fullname, FrequentFlyerNumber,TicketNumber,TripId,FlightId,LodgingId,OtherTransportationId,RestaurantId,CarRentalId,ActivityTaskId")] Human human)
        {
            if (id != human.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(human);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HumanExists(human.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                if (DatabaseManager.FlightId != 0)
                {
                    return(RedirectToAction("Details", "Flights", new { Id = human.FlightId }));
                }
                if (DatabaseManager.LodgingId != 0)
                {
                    return(RedirectToAction("Details", "Lodgings", new { Id = human.LodgingId }));
                }
                if (DatabaseManager.OtherTransportationId != 0)
                {
                    return(RedirectToAction("Details", "OtherTransportations", new { Id = human.OtherTransportationId }));
                }
                if (DatabaseManager.RestaurantId != 0)
                {
                    return(RedirectToAction("Details", "Restaurants", new { Id = human.RestaurantId }));
                }
                if (DatabaseManager.CarRentalId != 0)
                {
                    return(RedirectToAction("Details", "CarRentals", new { Id = human.CarRentalId }));
                }
                if (DatabaseManager.ActivityTaskId != 0)
                {
                    return(RedirectToAction("Details", "ActivityTasks", new { Id = human.ActivityTaskId }));
                }
            }
            return(View(human));
        }