TransactionalNodeService.Common.MapParameter.ExistsInDb C# (CSharp) Method

ExistsInDb() public method

public ExistsInDb ( IDbConnectionAbstraction connectionAbstraction ) : bool
connectionAbstraction IDbConnectionAbstraction
return bool
        public bool ExistsInDb(IDbConnectionAbstraction connectionAbstraction)
        {
            SqlCommand checkExistsSqlCommand = new SqlCommand(CheckParameterExists, connectionAbstraction.Connection);
            checkExistsSqlCommand.Parameters.Add(IdSqlParameter);

            connectionAbstraction.Open();
            int numberOfItems = (int)checkExistsSqlCommand.ExecuteScalar();
            connectionAbstraction.Close();

            if (numberOfItems > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }