public ActionResult Create([Bind(Include = "id,titulo,id_status,descricao,criacao,alteracao")] task task) { if (ModelState.IsValid) { db.tasks.Add(task); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.id_status = new SelectList(db.status, "id", "descricao", task.id_status); return(View(task)); }
public ActionResult SaveNewTask(task newTask) { tasklistEntities ORM = new tasklistEntities(); ORM.tasks.Add(newTask); ORM.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteTask(int taskid) { tasklistEntities ORM = new tasklistEntities(); task TaskToDelete = ORM.tasks.Find(taskid); ORM.tasks.Remove(TaskToDelete); ORM.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult CompleteTask(int taskid) { tasklistEntities ORM = new tasklistEntities(); task TaskToComplete = ORM.tasks.Find(taskid); if (TaskToComplete.status == false) { TaskToComplete.status = true; } else { TaskToComplete.status = false; } ORM.Entry(TaskToComplete).State = System.Data.Entity.EntityState.Modified; ORM.SaveChanges(); return(RedirectToAction("Index")); }