예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Titulo,TituloOriginal,Ano,GeneroId")] Filme filme)
        {
            if (id != filme.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(filme);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FilmeExists(filme.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GeneroId"] = new SelectList(_context.Genero, "Id", "Descricao", filme.GeneroId);
            return(View(filme));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Sobrenome,Nascimento")] Pessoa pessoa)
        {
            if (id != pessoa.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pessoa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PessoaExists(pessoa.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pessoa));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Descricao")] Genero genero)
        {
            if (id != genero.Id)
            {
                return(NotFound());
            }

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