public async Task <IActionResult> Create([Bind("OutboundFlightId,CustomerId,OutboundDate,OneWay,ReturnFlightId,ReturnDate")] Travel travel)
        {
            if (ModelState.IsValid)
            {
                travel.OutboundFlightId = Guid.NewGuid();
                _context.Add(travel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "CustomerId", travel.CustomerId);
            return(View(travel));
        }
Ejemplo n.º 2
0
 public Task <int> AddAsync(Airline a)
 {
     _dbContext.Airlines.AddAsync(a);
     return(_dbContext.SaveChangesAsync());
 }