public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Endereco,Telefone,DataNascimento,CPF,CartaoCredito")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("IdBolo,SaborRecheio,SaborMassa,TipoCobertura,DiamentroCentimetro,QuantidadeAndar,QuantidadeBolo,ValorUnitario")] Bolo bolo)
        {
            if (id != bolo.IdBolo)
            {
                return(NotFound());
            }

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