public async Task <IActionResult> Edit(int id, [Bind("TarefaId,Nome,Descricao,Inicio,Fim,Importancia")] 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)));
            }
            return(View(tarefa));
        }
Exemplo n.º 2
0
 public void Update <T>(T entity) where T : class
 {
     _context.Update(entity);
 }