public JsonResult ExcluirRegistroDeTarefaNoBD(int id) { using (var db = new SeletivoUCDBDbContext()) { var tarefaLocalizada = db.Tarefas.Find(id); if (tarefaLocalizada != null) { db.Tarefas.Remove(tarefaLocalizada); db.SaveChanges(); return(Json(new { success = true })); } return(Json(new { success = false })); } }
public JsonResult AdicionarTarefaNoBD(Tarefa tarefa) { if (tarefa != null) { using (var db = new SeletivoUCDBDbContext()) { db.Tarefas.Add(tarefa); db.SaveChanges(); return(Json(new { success = true })); } } return(Json(new { success = false })); }
public JsonResult AtualizarStatusDaTarefaNoBD(Tarefa tarefa) { if (tarefa != null) { using (var db = new SeletivoUCDBDbContext()) { var tarefaLocalizada = db.Tarefas.Find(tarefa.Id); tarefaLocalizada.StatusTarefa = tarefa.StatusTarefa; db.SaveChanges(); return(Json(new { success = true })); } } return(Json(new { success = false })); }