public ActionResult DeleteItem(int taskID) { Tasksss ItemToDelete = ORM.Taskssses.Find(taskID); ORM.Taskssses.Remove(ItemToDelete); ORM.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult AddTask(Tasksss task) { if (ModelState.IsValid) { ORM.Taskssses.Add(task); ORM.SaveChanges(); return(View("AddingTask")); } else { return(View("AddingTask")); } }
public ActionResult ToggleStatus(int taskID) { Tasksss ItemToToggle = ORM.Taskssses.Find(taskID); if (ItemToToggle.Completion == true) { ItemToToggle.Completion = false; } else { ItemToToggle.Completion = true; } ORM.Entry(ItemToToggle).State = System.Data.Entity.EntityState.Modified; ORM.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult EditTask(int taskID, Tasksss NewTask) { Tasksss found = ORM.Taskssses.Find(taskID); ViewBag.Task = found; if (found != null) { Tasksss oldTask = ORM.Taskssses.Find(NewTask.TaskID); oldTask.Description = NewTask.Description; oldTask.DueDate = NewTask.DueDate; oldTask.Completion = NewTask.Completion; ORM.Entry(oldTask).State = System.Data.Entity.EntityState.Modified; ORM.SaveChanges(); return(View("Index")); } return(View("Index")); }