Beispiel #1
0
        public IActionResult Booked(string toFlight, string fromFlight)
        {
            var salida  = _flightRep.GetById(fromFlight);
            var retorno = _flightRep.GetById(toFlight);

            UserBooks reseva = new UserBooks
            {
                UserName = User.Identity.Name,
                Travel   = new Travel
                {
                    Parting   = salida,
                    Returning = retorno
                }
            };

            _bookRep.Save(reseva);

            return(RedirectToAction("Booked", "Home"));
        }
Beispiel #2
0
        internal Flight Get(int id)
        {
            Flight Flight = _repo.GetById(id);

            if (Flight == null)
            {
                throw new Exception("invalid Id");
            }
            return(Flight);
        }
        public void Should_save_flight()
        {
            var flight     = new FlightTestBuilder().Build();
            var repository = new FlightRepository(this.DbContext);

            repository.Add(flight);
            ClearChangeTracker();

            var actualFlight = repository.GetById(flight.Id);

            actualFlight.Should().BeEquivalentTo(flight);
        }