public ActionResult DeleteToDo(int toDoId, int categoryId)
        {
            using (ToDoRepo todoRepo = new ToDoRepo())
            {
                todoRepo.DeleteToDo(toDoId);
                todoRepo.Save();

                // Redirect to the dashboard
                return(RedirectToAction("Index", new { categoryId = categoryId }));
            }
        }
        public ActionResult MarkToDoComplete(int toDoId)
        {
            using (ToDoRepo todoRepo = new ToDoRepo())
            {
                var categoryId = todoRepo.MarkToDoComplete(toDoId);
                todoRepo.Save();

                // Redirect to the dashboard
                return(RedirectToAction("Index", new { categoryID = categoryId }));
            }
        }
        public ActionResult AddToDo(string toDoTitle, int categoryId, int urgency = 1)
        {
            if (!String.IsNullOrEmpty(toDoTitle))
            {
                using (ToDoRepo todoRepo = new ToDoRepo())
                {
                    todoRepo.Insert(new ToDo()
                    {
                        Title      = toDoTitle,
                        CategoryId = categoryId,
                        UserId     = User.Identity.GetUserId(),
                        Urgency    = urgency,
                        Finished   = false
                    });

                    todoRepo.Save();
                }
            }

            // Redirect to the dashboard
            return(RedirectToAction("Index", new { categoryId = categoryId }));
        }