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)); }
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()); }
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)); }
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()); }
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)); }
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)); }
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)); }
public void Update(T entity) { _context.Entry(entity); _context.SaveChanges(); }