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); }
private QuestionDbo InsertQuestion(IQuestion question) { if (question is QuadraticEquation quadratic) { var quadraticDbo = new QuadraticEquationDbo(quadratic); return(AddQuadratic(quadraticDbo)); } else if (question is LinearSimultaneousEquations simultaneous) { var simultaneousDbo = new LinearSimultaneousEquationsDbo(simultaneous); return(AddSimultaneous(simultaneousDbo)); } else { throw new NotImplementedException(); } }