Exemple #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("BookingId,ClientId,RouteId,PaymentDate,PaymentMethod,FlightClass,BookingDate")] Booking booking)
        {
            if (id != booking.BookingId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(booking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookingExists(booking.BookingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"] = new SelectList(_context.Clients, "Id", "Id", booking.ClientId);
            ViewData["RouteId"]  = new SelectList(_context.Routes, "RouteId", "RouteId", booking.RouteId);
            return(View(booking));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("RouteId,DepartureLocation,DestinationLocation")] Route route)
        {
            if (id != route.RouteId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(route);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RouteExists(route.RouteId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(route));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PlaneId,LocationFrom,LocationTo,DepartTime,ArrivalTime,PlaneType,PilotName,PlaneCapacityNormal,PlaneCapacityBusiness,AlreadyReserved")] Flights flights)
        {
            if (id != flights.PlaneId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(flights);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FlightsExists(flights.PlaneId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(flights));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,Lastname,IdentifiactionalNumber,PhoneNumber,Email")] Reservations reservations)
        {
            if (id != reservations.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(reservations);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReservationsExists(reservations.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(reservations));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("FlightId,PlaneId,RouteId,DepartureDate,DepartureHour,DestinationHour")] Flight flight)
        {
            if (id != flight.FlightId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(flight);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FlightExists(flight.FlightId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PlaneId"] = new SelectList(_context.Planes, "PlaneId", "PlaneId", flight.PlaneId);
            ViewData["RouteId"] = new SelectList(_context.Routes, "RouteId", "RouteId", flight.RouteId);
            return(View(flight));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("LineId,Name")] Line line)
        {
            if (id != line.LineId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(line);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LineExists(line.LineId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(line));
        }
Exemple #7
0
        public async Task <IActionResult> Edit(Guid id, [Bind("StopId,StopLocation")] Stop stop)
        {
            if (id != stop.StopId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(stop);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StopExists(stop.StopId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(stop));
        }
Exemple #8
0
        public async Task <IActionResult> Edit(Guid id, [Bind("PlaneId,Model,Manufacturer,LineId")] Plane plane)
        {
            if (id != plane.PlaneId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(plane);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlaneExists(plane.PlaneId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LineId"] = new SelectList(_context.Lines, "LineId", "LineId", plane.LineId);
            return(View(plane));
        }
Exemple #9
0
        public async Task <IActionResult> Edit(Guid id, [Bind("CardId,ClientId,ExpirationDate,Number,CVC")] Card card)
        {
            if (id != card.CardId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(card);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CardExists(card.CardId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"] = new SelectList(_context.Clients, "Id", "Id", card.ClientId);
            return(View(card));
        }
Exemple #10
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Route_StopId,StopId,RouteId,StopTime")] Route_Stop route_Stop)
        {
            if (id != route_Stop.Route_StopId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(route_Stop);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Route_StopExists(route_Stop.Route_StopId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RouteId"] = new SelectList(_context.Routes, "RouteId", "RouteId", route_Stop.RouteId);
            ViewData["StopId"]  = new SelectList(_context.Stops, "StopId", "StopId", route_Stop.StopId);
            return(View(route_Stop));
        }