//get SubTask
        public SubTask getSubtask(int id)
        {
            var subtask = new SubTask();

            using (var db = new HealthModelsDataContext())
            {
                var query = db.SubTasks.SingleOrDefault(targetSubtask => targetSubtask.id.Equals(id));
                subtask = query;
            }

            return subtask;
        }
        //create SubTask
        public void createSubtask(string taskName, string description, string status)
        {
            using (var db = new HealthModelsDataContext())
            {
                Task task = db.Tasks.SingleOrDefault(targetTask => targetTask.taskName.Equals(taskName));
                if (task != null)
                {
                    var subtask = new SubTask();

                    subtask.taskId = task.id;
                    subtask.description = description;
                    subtask.status = status;

                    db.SubTasks.InsertOnSubmit(subtask);
                    db.SubmitChanges();
                }
            }
        }
 partial void DeleteSubTask(SubTask instance);
 partial void UpdateSubTask(SubTask instance);
 partial void InsertSubTask(SubTask instance);
		private void detach_SubTasks(SubTask entity)
		{
			this.SendPropertyChanging();
			entity.Task = null;
		}
		private void attach_SubTasks(SubTask entity)
		{
			this.SendPropertyChanging();
			entity.Task = this;
		}
        //update SubTask
        public void updateSubtask(int id, string description, string status)
        {
            var subtask = new SubTask();

            using (var db = new HealthModelsDataContext())
            {
                subtask = db.SubTasks.SingleOrDefault(targetSubtask => targetSubtask.id.Equals(id));

                if (subtask != null)
                {
                    subtask.description = description;
                    subtask.status = status;

                    db.SubmitChanges();
                }
            }
        }