public HttpResponseMessage Post([FromUri] string traveler) { using (var context = new TravelCompanionContext()) { Traveler newTraveler = new Traveler { FirstName = traveler, LastName = "Mc" + traveler, HomeAddress = "One Microsoft Way", MobilePhone = "555-555-5555", Passport = "AB123456789", TravelerUserIdentity = Guid.NewGuid().ToString() }; context.Travelers.Add(newTraveler); context.SaveChanges(); Flight flight = context.Flights.First(); Reservation reservation = new Reservation { ReservationDate = DateTime.Now, DepartureFlight = new Trip { FlightInfo = flight.Schedules.First(), Status = FlightStatus.Confirmed, Class = SeatClass.Economy }, ReturnFlight = null, ConfirmationCode = Guid.NewGuid().ToString(), TravelerId = newTraveler.TravelerId }; context.Reservations.Add(reservation); context.SaveChanges(); } // TODO: Lab 12, Exercise 1, Task 1.4 : Delete the cached results from Redis RedisProvider.Cache.KeyDelete(RESERVATIONS_KEY); return(Request.CreateResponse(HttpStatusCode.Created)); }
public void Save() { context.SaveChanges(); }