Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Clima,Vegetacion,ItinerarioId")] Habitat habitat)
        {
            if (id != habitat.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(habitat);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HabitatExists(habitat.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ItinerarioId"] = new SelectList(_context.Set <Itinerario>(), "Id", "Id", habitat.ItinerarioId);
            return(View(habitat));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Codigo,Duracion,Visitantes,Longitud")] Itinerario itinerario)
        {
            if (id != itinerario.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(itinerario);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItinerarioExists(itinerario.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(itinerario));
        }