I am designing a small questionnaire web service application but however I would like if someone can look at my design and see if it good approach I am taking.The application has the following classes:QuestionnaireAnswerIQuestionRepositoryQuestionRepository implements IQuestionRepositoryIn the QuestionRepository I have three methods:GetQuestionnaire() returns a list of questionnaire to the clientGetAnswerOptions(int questionId)When creating a questionnaire object this method is called inside the questionnaire constructor to get a list of possible answer for each question. This is the part I am not sure to create an repository object inside the questionnaire constructor because I was thinking what would be the best way to inject the possible answer list into the questionnaire object.GetMarks mark the questionnaire result    [DataContract]    public class Questionnaire    {        public Questionnaire() {        }        public Questionnaire(int _questionId) {            QuestionId = _questionId;            PossibleAnswer = new QuestionRepository().GetAnswerOptions(_questionId);        }        [DataMember]        public int QuestionId { get; set; }        [DataMember]        public string QuestionAsk { get; set; }        [DataMember]        public string Title { get; set; }        [DataMember]        public string UserAnsResponse { get; set; }        [DataMember]        public string PossibleAnswer { get; set; }        [DataMember]        public int QuestionnaireType { get; set; }        [DataMember]        public bool? isCorrectAnswer { get; set; }    }    [DataContract]    public class Answer {        [DataMember]        public int AnswerId { get; set; }        [DataMember]        public string AnswerText { get; set; }        [DataMember]        public Questionnaire Question { get; set; }    }    public interface IQuestionRepository    {        List<Questionnaire> GetQuestionnaire();        double GetMarks(List<Questionnaire> qList);        string GetAnswerOptions(int questionId);    }public class QuestionRepository : IQuestionRepository{    //this is a hack normally will pull data from a data source like DB/CSV    public static List<Answer> GetAnswerLibrary() {        List<Answer> AnsLibrary = new List<Answer>();        AnsLibrary.Add(new Answer() { AnswerId = 1, AnswerText = London, Question = new Questionnaire() { QuestionId= 11 } });        AnsLibrary.Add(new Answer() { AnswerId = 2, AnswerText = paris, Question = new Questionnaire() { QuestionId = 22 } });        AnsLibrary.Add(new Answer() { AnswerId = 3, AnswerText = Warsaw, Question = new Questionnaire() { QuestionId = 33 } });        AnsLibrary.Add(new Answer() { AnswerId = 4, AnswerText = Port louis, Question = new Questionnaire() { QuestionId = 44 } });        AnsLibrary.Add(new Answer() { AnswerId = 5, AnswerText = Berlin, Question = new Questionnaire() { QuestionId = 55 } });        return AnsLibrary;    }    //this is a hack normally will pull data from a data source like DB/CSV    public static List<Questionnaire> GetQuestionLibrary() {        List<Questionnaire> QuestionLibrary = new List<Questionnaire>();        QuestionLibrary.Add(new Questionnaire(11) { Title = Geo, QuestionAsk = What is the capital of England, QuestionnaireType = 1 });        QuestionLibrary.Add(new Questionnaire(22) { Title = Geo, QuestionAsk = What is the capital of France, QuestionnaireType = 1 });        QuestionLibrary.Add(new Questionnaire(33) { Title = Geo, QuestionAsk = What is the capital of Poland, QuestionnaireType = 1 });        QuestionLibrary.Add(new Questionnaire(44) { Title = Geo, QuestionAsk = What is the capital of Mauritius, QuestionnaireType = 1 });        QuestionLibrary.Add(new Questionnaire(55) { Title = Geo, QuestionAsk = What is the capital of Germany, QuestionnaireType = 1 });        return QuestionLibrary;    }    public List<Questionnaire> GetQuestionnaire()    {        return GetQuestionLibrary();    }    public string GetAnswerOptions(int questionId) {        string ans = string.Empty;        var Anslibrary = GetAnswerLibrary();        Dictionary<int, string> GetPossibleAnswerCombination = new Dictionary<int, string>();         if (Anslibrary.Count > 0){            try {                bool CheckIsAnswerExisr = Anslibrary.Any(x => x.Question.QuestionId == questionId);                if (CheckIsAnswerExisr) {                    var ValidAnswer = Anslibrary.Where(x => x.Question.QuestionId == questionId).FirstOrDefault();                    GetPossibleAnswerCombination.Add(ValidAnswer.AnswerId, ValidAnswer.AnswerText);                }                else {                    throw new Exception(Missing Answer for questionid + questionId);                }                Random rnd = new Random();                while (GetPossibleAnswerCombination.Count < 3) {                    var randomIndex = rnd.Next(0, Anslibrary.Count - 1);                    var GetRandomPossibleAnswer = Anslibrary[randomIndex];                    if (GetRandomPossibleAnswer.Question.QuestionId != questionId && !GetPossibleAnswerCombination.ContainsKey(GetRandomPossibleAnswer.AnswerId)) {                        GetPossibleAnswerCombination.Add(GetRandomPossibleAnswer.AnswerId, GetRandomPossibleAnswer.AnswerText);                    }                }                var sheffuleAnswer = GetPossibleAnswerCombination.Values.OrderBy(x => Guid.NewGuid()).ToArray();                ans = string.Join( ,, sheffuleAnswer);            }            catch (Exception ex) {                ex.ToString();            }        }        return ans;    }    public double GetMarks(List<Questionnaire> qList) {        var AnsLibrary = GetAnswerLibrary();        double result = 0;        double TotalNumberofQuestion = qList.Count();        int UserValidAnswer = 0;        try {            if(TotalNumberofQuestion > 0) {                var filterQuestionaire = qList.Where(q => q.UserAnsResponse != null).ToList();                foreach(var q2 in filterQuestionaire) {                    bool checkOnlyAnswerQuestion = AnsLibrary.Any(x => x.Question.QuestionId == q2.QuestionId);                    if(checkOnlyAnswerQuestion) {                        string city = (q2.UserAnsResponse).Trim();                        bool checkifValidAnswer = AnsLibrary.Any(x => x.Question.QuestionId == q2.QuestionId && x.AnswerText == city);                        if(q2.isCorrectAnswer == true && checkifValidAnswer == true) {                            UserValidAnswer++;                        }                        if(q2.isCorrectAnswer == false && checkifValidAnswer == false) {                            UserValidAnswer++;                        }                    }                }                result = UserValidAnswer / TotalNumberofQuestion * 100;            }        } catch(Exception ex) {            ex.ToString();        }        return result;    }}
Questionnaire design puzzle
c#;object oriented;asp.net;asp.net mvc 4;wcf