public ActionResult Edit(int id, Tarefa tarefa) { if (ModelState.IsValid) { try { TarefaDAO tarefasDatabase = new TarefaDAO(); tarefasDatabase.Editar(tarefa); return(RedirectToAction("Index")); } catch (Exception ex) { return(View(ex.ToString())); } } else { return(View(tarefa)); } }