Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,LocationFrom,Destination,DateOfDeparture,DepartureHour,ArrivalDate,ArrivalHour,FlightDuration,Plane,PlaneNumber,PilotName,TotalPassengersSeats,TotalBusinessClassSeats,FreeSeats,FreeBusinessClass")] 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(nameof(Index)));
            }
            return(View(flight));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,MiddleName,LastName,EGN,PhoneNumber,Nationality,TicketType,FlightID")] Passenger passenger)
        {
            if (id != passenger.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(passenger);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PassengerExists(passenger.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FlightID"] = new SelectList(_context.Flights, "Id", "Id", passenger.FlightID);
            return(View(passenger));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Username,Password,Email,FirstName,LastName,EGN,Adress,PhoneNumber,Role")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }