Пример #1
0
        public void createRubric(Rubric rubric)
        {
            NpgsqlConnection connection = DBConnectionService.getFreeConnection();
            NpgsqlCommand command = new NpgsqlCommand(createRubricCommand, connection);

            command.Parameters.AddWithValue("@title", NpgsqlTypes.NpgsqlDbType.Text, rubric.title);
            command.Parameters.AddWithValue("@parentID", NpgsqlTypes.NpgsqlDbType.Integer, rubric.parentID);
            int result = command.ExecuteNonQuery();

            DBConnectionService.returnConnection(connection);
        }
Пример #2
0
 public void updateRubric(Rubric user)
 {
     RubricsRepository.Singleton.updateRubric(user);
 }
Пример #3
0
 public void createRubric(Rubric user)
 {
     RubricsRepository.Singleton.createRubric(user);
 }
Пример #4
0
        public void updateRubric(Rubric rubric)
        {
            NpgsqlConnection connection = DBConnectionService.getFreeConnection();
            NpgsqlCommand command = new NpgsqlCommand(updateRubricCommand, connection);

            command.Parameters.AddWithValue("@id", NpgsqlTypes.NpgsqlDbType.Integer, rubric.id);
            command.Parameters.AddWithValue("@title", NpgsqlTypes.NpgsqlDbType.Text, rubric.title);
            command.Parameters.AddWithValue("@parentID", NpgsqlTypes.NpgsqlDbType.Text, rubric.parentID);
            int result = command.ExecuteNonQuery();

            if (result != 1)
            {
                throw new Exception("Error on rubric update");
            }

            DBConnectionService.returnConnection(connection);
        }