Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CEP,Complemento,Rua,Numero,Cidade,Estado,ClienteId,ProdutosId")] Endereco endereco)
        {
            if (id != endereco.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(endereco);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnderecoExists(endereco.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(endereco));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(Clientes clientes)
        {
            if (ModelState.IsValid)
            {
                _projetocontexto.Update(clientes);
                await _projetocontexto.SaveChangesAsync(clientes);

                return(RedirectToAction("Index"));
            }

            return(View(clientes));
        }