Table of Contents

Interface IMedicineRepository

Namespace
adas_core.Application.Repositories.Interfaces
Assembly
adas-core.Application.dll
public interface IMedicineRepository : IMongoRepository<Medicine>
Inherited Members
Extension Methods

Methods

DeleteMedicineById(ObjectId)

Asynchronously deletes a medicine record from the data store using the specified identifier.

Task DeleteMedicineById(ObjectId medicineId)

Parameters

medicineId ObjectId

The unique identifier of the medicine to delete.

Returns

Task

GetAll()

Asynchronously retrieves all medicines from the data source.

Task<List<Medicine>> GetAll()

Returns

Task<List<Medicine>>

A task that represents the asynchronous operation. The task result contains a list of Medicine objects; an empty list is returned when no medicines are found.

GetDistinctFieldDataQuery(string)

Builds a MongoDB aggregation pipeline that retrieves the distinct values for the specified field.

IAggregateFluent<BsonDocument> GetDistinctFieldDataQuery(string field)

Parameters

field string

The name of the field whose distinct values should be queried.

Returns

IAggregateFluent<BsonDocument>

An MongoDB.Driver.IAggregateFluent<TResult> representing the distinct field data query.

GetMedicine(string)

Retrieves a medicine by its code asynchronously.

Task<Medicine?> GetMedicine(string code)

Parameters

code string

The code used to look up the medicine.

Returns

Task<Medicine>

A task that returns the matching Medicine if found, or null if no medicine matches the specified code.

GetMedicineByCodeOrNote(List<string>)

Retrieves a list of medicines that match the specified codes or notes.

Task<List<Medicine>> GetMedicineByCodeOrNote(List<string> codeNotes)

Parameters

codeNotes List<string>

The list of codes or notes used to look up the medicines.

Returns

Task<List<Medicine>>

A task that represents the asynchronous operation, containing the list of matching medicines.

GetMedicineById(ObjectId)

Retrieves a medicine entity by its unique identifier from the data store. Returns null if no medicine matches the provided identifier.

Task<Medicine?> GetMedicineById(ObjectId medicineId)

Parameters

medicineId ObjectId

The unique MongoDB.Bson.ObjectId of the medicine to retrieve.

Returns

Task<Medicine>

A Task<TResult> containing the matching Medicine if found, or null when no record exists for the given identifier.

GetMedicineByName(string)

Retrieves a Medicine entity by its name asynchronously.

Task<Medicine?> GetMedicineByName(string name)

Parameters

name string

The name of the medicine to look up.

Returns

Task<Medicine>

A Task<TResult> that resolves to the matching Medicine, or null if no medicine with the specified name is found.

GetPaginatedMedicines(PaginationFilter)

Retrieves a paginated collection of medicines based on the specified pagination filter.

IFindFluent<Medicine, Medicine> GetPaginatedMedicines(PaginationFilter filter)

Parameters

filter PaginationFilter

The pagination filter containing the page number and page size used to control the result set.

Returns

IFindFluent<Medicine, Medicine>

A fluent query interface for the paginated medicines.

PostMedicine(Medicine)

Asynchronously creates and posts a new medicine entry, returning the persisted Medicine on success or null when no result is produced.

Task<Medicine?> PostMedicine(Medicine medicine)

Parameters

medicine Medicine

The medicine entity to be created and submitted.

Returns

Task<Medicine>

A task that resolves to the newly created Medicine, or null if the operation does not yield a result.

UpdateMedicine(Medicine)

Updates an existing medicine record with the provided information.

Task<Medicine?> UpdateMedicine(Medicine medicine)

Parameters

medicine Medicine

The medicine entity containing the updated data, typically identified by its primary key.

Returns

Task<Medicine>

A task that represents the asynchronous operation. The task result contains the updated Medicine, or null if no matching medicine was found.