Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ClienteId,NomeCliente,Cnpj,Endereco,Telefone")] Cliente cliente)
        {
            if (id != cliente.ClienteId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cliente);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClienteExists(cliente.ClienteId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cliente));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("TarefaId,ClienteId,Descricao,Prioridade")] Tarefa tarefa)
        {
            if (id != tarefa.TarefaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tarefa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TarefaExists(tarefa.TarefaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClienteId"] = new SelectList(_context.Cliente, "ClienteId", "ClienteId", tarefa.ClienteId);
            return(View(tarefa));
        }