# Class ConfigPumpsRepository

Namespace
  adas_core.Infrastructure.Repositories

Assembly
  adas-core.Infrastructure.dll

Repository for managing ConfigPumps in MongoDB. Provides methods to retrieve, update, and delete pump configurations.

    public class ConfigPumpsRepository : MongoRepository<ConfigPumps>, IConfigPumpsRepository, IMongoRepository<ConfigPumps>

Inheritance
  object
  MongoRepository<ConfigPumps>
  ConfigPumpsRepository

Implements
  IConfigPumpsRepository
  IMongoRepository<ConfigPumps>

Inherited Members
  MongoRepository<ConfigPumps>.Db
  MongoRepository<ConfigPumps>.Collection
  MongoRepository<ConfigPumps>.InsertOneAsync(ConfigPumps)
  MongoRepository<ConfigPumps>.UpdateOneAsync(ObjectId, ConfigPumps)
  MongoRepository<ConfigPumps>.DeleteAsync(ObjectId)
  MongoRepository<ConfigPumps>.CreateIndexes()
  MongoRepository<ConfigPumps>.InsertInitialLoad()
  MongoRepository<ConfigPumps>.InsertManyAsync(List<ConfigPumps>)
  MongoRepository<ConfigPumps>.UpdateManyObjectIdAsync(string, ObjectId, ObjectId)
  MongoRepository<ConfigPumps>.DeleteAsync(string)
  MongoRepository<ConfigPumps>.CollectionExists(string)
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Constructors

### ConfigPumpsRepository(IOptions<ApiSettings>, IMongoDatabase)

Initializes a new instance of the ConfigPumpsRepository class with the specified API settings and MongoDB database.

    public ConfigPumpsRepository(IOptions<ApiSettings> apiSettings, IMongoDatabase database)

#### Parameters

`apiSettings` IOptions<ApiSettings>

  The API settings.

`database` IMongoDatabase

  The MongoDB database instance.

#### Exceptions

ArgumentNullException

  Thrown when apiSettings is null.

## Methods

### DeleteConfig(ConfigPumps)

Deletes a ConfigPumps document from the MongoDB collection based on its Id. The method takes a ConfigPumps object, deletes the corresponding document, and returns true if the deletion was successful (i.e., the document no longer exists), or false if the document still exists after the deletion attempt.

    public Task<bool> DeleteConfig(ConfigPumps config)

#### Parameters

`config` ConfigPumps

  The ConfigPumps object to be deleted.

#### Returns

Task<bool>

  True if the deletion was successful, false otherwise.

### FindById(string)

Finds a ConfigPumps document by its unique identifier. Returns the ConfigPumps if found, or null if not found.

    public Task<ConfigPumps?> FindById(string id)

#### Parameters

`id` string

  The unique identifier of the ConfigPumps document.

#### Returns

Task<ConfigPumps>

  The ConfigPumps document if found, or null if not found.

### GetAllConfigs()

Retrieves all ConfigPumps documents from the MongoDB collection. Returns a list of ConfigPumps or null if no documents are found.

    public Task<List<ConfigPumps>?> GetAllConfigs()

#### Returns

Task<List<ConfigPumps>>

  A list of ConfigPumps or null if no documents are found.

### GetCollectionName()

Gets the name of the MongoDB collection for ConfigPumps. Uses the value from API settings or defaults to "config_pumps".

    public override string GetCollectionName()

#### Returns

string

  The name of the MongoDB collection for ConfigPumps.

### UpdateConfig(ConfigPumps)

Updates an existing ConfigPumps document in the MongoDB collection. The method takes a ConfigPumps object, updates the corresponding document based on its Id, and returns the updated ConfigPumps. If the document is not found, it returns null.

    public Task<ConfigPumps?> UpdateConfig(ConfigPumps config)

#### Parameters

`config` ConfigPumps

  The ConfigPumps object containing the updated data.

#### Returns

Task<ConfigPumps>

  The updated ConfigPumps document if found, or null if not found.