コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("id_municipio,nombre_municipio,municipio_id_municipio")] Municipio municipio)
        {
            if (id != municipio.id_municipio)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(municipio);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MunicipioExists(municipio.id_municipio))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(municipio));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("id_localidades,localidad,municipio_id_municipio")] Localidades localidades)
        {
            if (id != localidades.id_localidades)
            {
                return(NotFound());
            }

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