public async Task <IActionResult> Edit(int id, [Bind("Postcode,City")] DeparturePoint departurePoint)
        {
            if (id != departurePoint.Postcode)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(departurePoint);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DeparturePointExists(departurePoint.Postcode))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(departurePoint));
        }
        public async Task <IActionResult> Create([Bind("Postcode,City")] DeparturePoint departurePoint)
        {
            if (ModelState.IsValid)
            {
                _context.Add(departurePoint);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(departurePoint));
        }
Exemplo n.º 3
0
        public void AddUniverseInfo()
        {
            DeparturePoint.AddUniverseInfo();
            Destination.AddUniverseInfo();

            if (FlightPath == null)
            {
                return;
            }

            foreach (var fix in FlightPath)
            {
                fix.AddUniverseInfo();
            }
        }