public void UpdateChoice(SelectableChoiceWithId choice) { using (var con = new OracleConnection(OracleUtility.conString)) { con.Open(); var cmd = con.CreateCommand(); cmd.CommandText = $"UPDATE {OracleDbTableName.Choice} SET Code=:Code, Content=:Content, IsCorrectAnswer=:IsCorrectAnswer WHERE Id=:Id"; cmd.Parameters.Add("Code", choice.Code); cmd.Parameters.Add("Content", choice.Content); cmd.Parameters.Add("IsCorrectAnswer", choice.IsCorrectAnswer.ToString()); cmd.Parameters.Add("Id", choice._id); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); } }
public void InsertChoice(SelectableChoiceWithId choice) { using (OracleConnection con = new OracleConnection(OracleUtility.conString)) { con.Open(); var cmd = con.CreateCommand(); cmd.CommandText = $"INSERT INTO {OracleDbTableName.Choice} " + $"VALUES(:Id,:Code,:Content,:IsCorrectAnswer,:QuestionId)"; cmd.Parameters.Add("Id", choice._id); cmd.Parameters.Add("Code", choice.Code); cmd.Parameters.Add("Content", choice.Content); cmd.Parameters.Add("IsCorrectAnswer", choice.IsCorrectAnswer.ToString()); cmd.Parameters.Add("QuestionId", choice.QuestionId); cmd.ExecuteNonQuery(); } }
public void UpdateChoice(SelectableChoiceWithId choice) { throw new NotImplementedException(); }