예제 #1
0
        public async Task <IActionResult> Edit(string id, [Bind("Codigo,Empresa,Hora,Estado,Lugar,Capacidadmaxima,Codigoaeropuerto")] Ruta ruta)
        {
            if (id != ruta.Codigo)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ruta);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RutaExists(ruta.Codigo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Codigoaeropuerto"] = new SelectList(_context.Aeropuerto, "Codigo", "Codigo", ruta.Codigoaeropuerto);
            return(View(ruta));
        }
        public async Task <IActionResult> Edit(string id, [Bind("Codigo,Nombre,Direccion,Habilitado")] Aeropuerto aeropuerto)
        {
            if (id != aeropuerto.Codigo)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(aeropuerto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AeropuertoExists(aeropuerto.Codigo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(aeropuerto));
        }
예제 #3
0
        public async Task <IActionResult> Edit([Bind("Codigoruta,Fecha,Capacidadreal")] Vuelo vuelo)
        {
            if (String.IsNullOrEmpty(vuelo.Codigoruta))
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vuelo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VueloExists(vuelo.Codigoruta, vuelo.Fecha))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            ViewData["Codigoruta"] = new SelectList(_context.Ruta, "Codigo", "Codigo", vuelo.Codigoruta);
            return(View(vuelo));
        }