public void UpdateQuestion(MultipleChoiceQuestionWithOneCorrectAnswerWithId question) { using (var con = new OracleConnection(OracleUtility.conString)) { con.Open(); var cmd = con.CreateCommand(); cmd.CommandText = $"UPDATE {OracleDbTableName.Question} SET No=:No, Code=:Code, Content=:Content, GroupId=:GroupId, NoShuffleChoice=:NoShuffleChoice WHERE Id=:Id"; cmd.Parameters.Add("No", question.No); cmd.Parameters.Add("Code", question.Code); cmd.Parameters.Add("Content", question.Content); cmd.Parameters.Add("GroupId", question.GroupId); cmd.Parameters.Add("NoShuffleChoice", question.NoShuffleChoice.ToString()); cmd.Parameters.Add("Id", question._id); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); } }
public void InsertQuestion(MultipleChoiceQuestionWithOneCorrectAnswerWithId question) { using (OracleConnection con = new OracleConnection(OracleUtility.conString)) { con.Open(); var cmd = con.CreateCommand(); cmd.CommandText = $"INSERT INTO {OracleDbTableName.Question} " + $"VALUES(:Id,:No,:Code,:Content,:GroupId,:NoShuffleChoice,:QuestionSuiteId)"; cmd.Parameters.Add("Id", question._id); cmd.Parameters.Add("No", question.No); cmd.Parameters.Add("Code", question.Code); cmd.Parameters.Add("Content", question.Content); cmd.Parameters.Add("GroupId", question.GroupId); cmd.Parameters.Add("NoShuffleChoice", question.NoShuffleChoice.ToString()); cmd.Parameters.Add("QuestionSuiteId", question.QuestionSuiteId); cmd.ExecuteNonQuery(); } }
public void UpdateQuestion(MultipleChoiceQuestionWithOneCorrectAnswerWithId question) { throw new NotImplementedException(); }