Exemple #1
0
        public void Update_Job_Questions_By_Form(int Job_ID, List <QuestionForm> formList)
        {
            using (db)
            {
                foreach (QuestionForm form in formList)
                {
                    QuestionIDJobID QJ = new QuestionIDJobID();
                    QJ.QuestionID = form.question.QuestionID;
                    QJ.Job_ID     = Job_ID;

                    if (form.checkedQuestion == true)
                    {
                        addQuestionToJob(QJ);
                    }
                    else if (form.checkedQuestion == false)
                    {
                        removeQuestionFromJob(QJ);
                    }
                }
            }
        }
Exemple #2
0
        public void removeQuestionFromJob(QuestionIDJobID questionIDjobID)
        {
            using (DB_9E5950_aes01Entities db = new DB_9E5950_aes01Entities())
            {
                var questionEntity = (from p in db.QuestionLists where p.Id == questionIDjobID.QuestionID select p).FirstOrDefault();

                var query =
                    from ja in db.JobApplications
                    where ja.Id == questionIDjobID.Job_ID
                    select ja;

                foreach (JobApplication japp in query)
                {
                    if (japp.Id == questionIDjobID.Job_ID)
                    {
                        japp.QuestionLists.Remove(questionEntity);
                    }
                }

                db.SaveChanges();
            }
        }