Ejemplo n.º 1
0
        public async Task <IActionResult> EditFlg(int id, [Bind("FlgID,AcID,FlgDeparture,FlgArrival,FlgFare,RouteID")] Flight flight)
        {
            if (id != flight.FlgID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    ctx.Update(flight);
                    await ctx.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ctx.Flights.Any(e => e.FlgID == flight.FlgID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AcID"] = new SelectList(ctx.Aircrafts, "AcID", "AcModel", flight.AcID);
            return(View(flight));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,UserName,Password,Email,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("Index"));
            }
            return(View(user));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> EditEmp(int id, [Bind("EmpID,EmpName,EmpLastName,EmpGender,EmpHomeAdrs,EmpPhoneNumber,EmpEmail,EmpBirthdate,EmpHireDate,EmpModifiedDate,EmpCardID,EmpSalary,EmpType")] Employee emp)
        {
            if (id != emp.EmpID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    emp.EmpModifiedDate = DateTime.Now;
                    ctx.Update(emp);
                    await ctx.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ctx.Employees.Any(e => e.EmpID == emp.EmpID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(emp));
        }
        public async Task <IActionResult> Edit(int id, [Bind("BookingID,FlightNumber,PassengerName,DepartingAirport,ArrivalAirport,CreatedDate,JourneyDate,MealPreference,EmailAddress")] 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["FlightNumber"] = new SelectList(_context.Flights, "FlightNumber", "FlightDestinationAirport", booking.FlightNumber);
            return(View(booking));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("FlightId,AirportStart,AirportEnd,FlightDate,FlightTime,NumFCSeats,FCSeatPrice,NumBusSeats,BusSeatPrice")] 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("Index"));
            }
            return(View(flight));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> EditAc(int id, [Bind("AcID,AcModel,AcType,AcCapacity,AcRegisterDate,AcModifiedDate")] Aircraft aircraft)
        {
            if (id != aircraft.AcID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    aircraft.AcModifiedDate = DateTime.Now;
                    ctx.Update(aircraft);
                    await ctx.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ctx.Aircrafts.Any(e => e.AcID == aircraft.AcID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(aircraft));
        }