示例#1
0
        public async Task <IActionResult> Editar(int id, [Bind("ID,Descricao,Localizacao")] Sessao sessao)
        {
            if (id != sessao.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sessao);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SessaoExists(sessao.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Listar)));
            }
            return(View(sessao));
        }
        public async Task <IActionResult> Editar(int id, [Bind("CPF,Nome,Tel")] Cliente cliente)
        {
            if (id != cliente.CPF)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cliente);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClienteExists(cliente.CPF))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Listar)));
            }
            return(View(cliente));
        }
        public async Task <IActionResult> Editar(int id, [Bind("CodigoLocacao,DataLocacao,DataDevolucao,Valor")] Locacao locacao)
        {
            if (id != locacao.CodigoLocacao)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(locacao);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocacaoExists(locacao.CodigoLocacao))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Listar)));
            }
            return(View(locacao));
        }
        public async Task <IActionResult> Editar(int id, [Bind("CodigoVideo,Titulo,Disponibilidade,QuantidadeEstoque,Genero")] Video video)
        {
            if (id != video.CodigoVideo)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(video);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VideoExists(video.CodigoVideo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Listar)));
            }
            return(View(video));
        }
示例#5
0
        public async Task <IActionResult> Editar(int id, [Bind("ID,AtorPrincipal")] Ator ator)
        {
            if (id != ator.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ator);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AtorExists(ator.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Listar)));
            }
            return(View(ator));
        }
示例#6
0
        public async Task <IActionResult> Editar(int id, [Bind("ID")] DVD dVD)
        {
            if (id != dVD.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dVD);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DVDExists(dVD.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Listar)));
            }
            return(View(dVD));
        }