public ActionResult ChangeStatus(string TaskNumber)
        {
            TaskListDBEntities ORM = new TaskListDBEntities();

            Task Found = ORM.Tasks.Find(TaskNumber);


            if (Found != null)
            {
                if (Found.Status == "Incomplete")
                {
                    Found.Status = "Completed";
                }
                else
                {
                    Found.Status = "Incomplete";
                }


                ORM.Entry(Found).State = System.Data.Entity.EntityState.Modified;


                ORM.SaveChanges();

                return(RedirectToAction("Welcome"));
            }
            else
            {
                ViewBag.Error.Message = "Task not found";
                return(View("Error"));
            }
        }
Beispiel #2
0
        public ActionResult Update(TaskList updateTask)
        {
            TaskListDBEntities ORM = new TaskListDBEntities();

            ORM.Entry(updateTask).State = EntityState.Modified;
            ORM.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        public ActionResult UpdateComplete(int taskID)
        {
            TaskListDBEntities ORM = new TaskListDBEntities();
            Task oldTask           = ORM.Tasks.Find(taskID);

            if (oldTask.Complete == false)
            {
                oldTask.Complete         = true;
                ORM.Entry(oldTask).State = System.Data.Entity.EntityState.Modified;
                ORM.SaveChanges();
                return(RedirectToAction("TaskList"));
            }
            else
            {
                return(RedirectToAction("TaskList"));
            }
        }
        public ActionResult SaveTaskUpdates(TasksTable UpdateTaskList)
        {
            TaskListDBEntities ORM           = new TaskListDBEntities();
            TasksTable         OldTaskRecord = ORM.TasksTables.Find(UpdateTaskList.TaskNumber);

            if (OldTaskRecord != null && ModelState.IsValid)
            {
                OldTaskRecord.Description      = UpdateTaskList.Description;
                OldTaskRecord.DueDate          = UpdateTaskList.DueDate;
                OldTaskRecord.Status           = UpdateTaskList.Status;
                OldTaskRecord.TaskNumber       = UpdateTaskList.TaskNumber;
                ORM.Entry(OldTaskRecord).State = System.Data.Entity.EntityState.Modified;
                ORM.SaveChanges();
                return(RedirectToAction("UserTasks"));
            }
            else
            {
                ViewBag.ErrorMessage = "Task not Found";
                return(View("Error"));
            }
        }
        public ActionResult ChangeStatus(string taskName)
        {
            TaskListDBEntities ORM = new TaskListDBEntities();
            Task Found             = ORM.Tasks.Find(taskName);

            if (Found != null)
            {
                if (Found.taskStatus == "Incomplete")
                {
                    Found.taskStatus = "Complete";
                }
                else
                {
                    Found.taskStatus = "Incomplete";
                }
                ORM.Entry(Found).State = System.Data.Entity.EntityState.Modified;
                ORM.SaveChanges();
                return(RedirectToAction("TaskList"));
            }
            else
            {
                return(View("Error"));
            }
        }