Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Pedido_id,Pedido_valor,CarrinhoItens_id,Pedido_dataCadastro")] Pedido pedido)
        {
            if (id != pedido.Pedido_id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pedido);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PedidoExists(pedido.Pedido_id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pedido));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Cliente_id,Nome,Email,DataCadastro")] Cliente cliente)
        {
            if (id != cliente.Cliente_id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cliente);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClienteExists(cliente.Cliente_id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cliente));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("produto_id,produto_nome,produto_desc,produto_ativo,produto_preco,produto_precoPromo")] Produto produto)
        {
            if (id != produto.Produto_id)
            {
                return(NotFound());
            }

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