Example #1
0
        private QuestionDbo AddSimultaneous(LinearSimultaneousEquationsDbo equations)
        {
            var questionType = context.QuestionTypeDbo.First(type => type.Type == "simultaneous");

            context.LinearSimultaneousEquationsDbo.Add(equations);
            context.SaveChanges();

            var question = new QuestionDbo(equations.ID, questionType);

            context.QuestionDbo.Add(question);
            context.SaveChanges();

            return(question);
        }
Example #2
0
        private QuestionDbo AddQuadratic(QuadraticEquationDbo equation)
        {
            var questionType = context.QuestionTypeDbo.First(type => type.Type == "quadratic");

            context.QuadraticEquationDbo.Add(equation);
            context.SaveChanges();

            var question = new QuestionDbo(equation.ID, questionType);

            context.QuestionDbo.Add(question);
            context.SaveChanges();

            return(question);
        }
Example #3
0
        private IQuestion FindQuestionCorrespondingToQuestionDbo(QuestionDbo question)
        {
            var questionType = question.QuestionType.Type;

            if (questionType == "quadratic")
            {
                return(context.QuadraticEquationDbo
                       .First(quadratic => quadratic.ID == question.SpecificQuestionID)
                       .CovertToQuadraticEquation());
            }
            else if (questionType == "simultaneous")
            {
                return(context.LinearSimultaneousEquationsDbo
                       .First(simultaneous => simultaneous.ID == question.SpecificQuestionID)
                       .CovertToLinearSimultaneousEquations());
            }
            else
            {
                throw new NotImplementedException();
            }
        }
 public WorksheetQuestionDbo(QuestionDbo question, WorksheetDbo worksheet, int questionNumber)
 {
     Question       = question;
     Worksheet      = worksheet;
     QuestionNumber = questionNumber;
 }