Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Email,DataAniversario,DataInscricao,PlanoId")] Cliente cliente)
        {
            if (id != cliente.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cliente);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClienteExists(cliente.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PlanoId"] = new SelectList(_context.Planos, "Id", "Id", cliente.PlanoId);
            return(View(cliente));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Cpf")] Funcionario funcionario)
        {
            if (id != funcionario.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(funcionario);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FuncionarioExists(funcionario.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(funcionario));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Cpf,DataNascimento")] Cliente cliente)
        {
            if (id != cliente.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cliente);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClienteExists(cliente.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cliente));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Descricao,ClienteId")] Produto produto)
        {
            if (id != produto.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(produto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProdutoExists(produto.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClienteId"] = new SelectList(_context.Cliente, "Id", "Nome", produto.ClienteId);
            return(View(produto));
        }
Ejemplo n.º 5
0
 public async Task UpdateAsync(Tentity entity)
 {
     _dbcontext.Entry(entity).State = EntityState.Modified;
     _dbcontext.Update(entity);
     await _dbcontext.SaveChangesAsync();
 }