Ejemplo n.º 1
0
        //public AllData(Respondent r)
        //{

        //    using (informatikexamenEntities db = new informatikexamenEntities())
        //    {

        //        List<QuestionResponse> tempList = db.QuestionResponse.ToList();

        //        RList = db.Response.ToList();

        //        QRList = new List<QuestionResponse>();

        //        List<Question> ql = db.Question.ToList();


        //        RQRList = db.RQR.Where(x => x.RespondentID == r.Id).ToList();
        //        RQTList = db.RQT.Where(x => x.RespondentID == r.Id).ToList();



        //        foreach (RQR rqr in RQRList)
        //        {
        //            foreach (QuestionResponse qr in tempList)
        //            {
        //                if (qr.Id == rqr.QuestionResponseID)
        //                {
        //                    QRList.Add(qr);
        //                }
        //            }
        //        }
        //    }
        //}
        public string GetAnswer(int qID)
        {
            Response response = new Response();

            response.ResponseText = "Saknas";
            using (informatikexamenEntities db = new informatikexamenEntities())
            {
                foreach (QuestionResponse qr in QRList)
                {
                    if (qr.QuestionID == qID)
                    {
                        response = RList.Where(x => x.Id == qr.ResponseID).FirstOrDefault();
                    }
                }
            }
            return(response.ResponseText);
        }