public ActionResult AddNewTask(Task newTask)
        {
            ViewBag.AuthorizedUser = TempData["AuthorizedUser"];

            TaskManagerDBEntities2 ORM = new TaskManagerDBEntities2();

            ORM.Tasks.Add(newTask);
            ORM.SaveChanges();

            TempData["AuthorizedUser"] = TempData["AuthorizedUser"];

            return(RedirectToAction("TaskList"));
        }
        public ActionResult AddUser(User newUser)

        {
            if (ModelState.IsValid)
            {
                TaskManagerDBEntities2 ORM = new TaskManagerDBEntities2();
                ORM.Users.Add(newUser);
                ORM.SaveChanges();
                return(View("TaskList"));
            }
            else
            {
                ViewBag.Message = "Oops!  It looks as though something has gone wrong!";
                return(View("Error"));
            }
        }
        public ActionResult DeleteTask(string TaskName)
        {
            TaskManagerDBEntities2 ORM = new TaskManagerDBEntities2();

            Task userTask = ORM.Tasks.Find(TaskName);

            if (userTask != null)
            {
                ORM.Tasks.Remove(userTask);
                ORM.SaveChanges();

                TempData["AuthorizedUser"] = TempData["AuthorizedUser"];

                return(RedirectToAction("TaskList"));
            }
            else
            {
                ViewBag.ErrorMessage = "Task not found!";
                return(View("Error"));
            }
        }
        public ActionResult MarkComplete(Task updatedTask)
        {
            TaskManagerDBEntities2 ORM = new TaskManagerDBEntities2();

            Task oldTaskRecord = ORM.Tasks.Find(updatedTask.TaskName);

            if (oldTaskRecord.Complete == "Not Complete")
            {
                updatedTask.Complete = "Complete";
            }
            else
            {
                updatedTask.Complete = "Not Complete";
            }

            oldTaskRecord.Complete         = updatedTask.Complete;
            ORM.Entry(oldTaskRecord).State = System.Data.Entity.EntityState.Modified;
            ORM.SaveChanges();

            TempData["AuthorizedUser"] = TempData["AuthorizedUser"];

            return(RedirectToAction("TaskList"));
        }