Exemple #1
0
        public ActionResult DeleteItem(int taskID)

        {
            Tasksss ItemToDelete = ORM.Taskssses.Find(taskID);

            ORM.Taskssses.Remove(ItemToDelete);

            ORM.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public ActionResult AddTask(Tasksss task)
 {
     if (ModelState.IsValid)
     {
         ORM.Taskssses.Add(task);
         ORM.SaveChanges();
         return(View("AddingTask"));
     }
     else
     {
         return(View("AddingTask"));
     }
 }
Exemple #3
0
        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"));
        }
Exemple #4
0
        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"));
        }