Пример #1
0
        public async Task <IHttpActionResult> PutCommercialFlight(string id, CommercialFlight commercialFlight)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != commercialFlight.IdFlight)
            {
                return(BadRequest());
            }

            db.Entry(commercialFlight).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CommercialFlightExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "UserName,Password,Role,EmailID")] FlyRegister flyAdmin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(flyAdmin).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(flyAdmin));
 }
Пример #3
0
        public async Task <IActionResult> PutCountry(int id, Country country)
        {
            if (id != country.Id)
            {
                return(BadRequest());
            }

            _context.Entry(country).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CountryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #4
0
        public async Task <IHttpActionResult> PutFlightPlace(int id, FlightPlace flightPlace)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != flightPlace.numPlace)
            {
                return(BadRequest());
            }

            db.Entry(flightPlace).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FlightPlaceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #5
0
        public async Task <IActionResult> PutPassenger(int id, Passenger passenger)
        {
            if (id != passenger.Passport)
            {
                return(BadRequest());
            }

            _context.Entry(passenger).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PassengerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #6
0
        public async Task <IHttpActionResult> PutDestination(string id, Destination destination)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != destination.ZipCode)
            {
                return(BadRequest());
            }

            db.Entry(destination).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DestinationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #7
0
 public ActionResult Edit([Bind(Include = "UserId,Name,Email")] FlyUser flyUser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(flyUser).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(flyUser));
 }
Пример #8
0
 public ActionResult Edit([Bind(Include = "TicketNo,FlightId,DateOfBooking,JourneyDate,Origin,Destination,PassengerName,ContactNo,Email,NoOfTickets,TotalFare,Status")] FlyReservation flyReservation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(flyReservation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FlightId = new SelectList(db.FlightsDetails, "FlightId", "Origin", flyReservation.FlightId);
     return(View(flyReservation));
 }
Пример #9
0
 public void Update(T entity)
 {
     _context.Entry(entity);
     _context.SaveChanges();
 }