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
medicineIdObjectIdThe unique identifier of the medicine to delete.
Returns
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
fieldstringThe 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
codestringThe code used to look up the medicine.
Returns
- Task<Medicine>
A task that returns the matching Medicine if found, or
nullif 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
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
medicineIdObjectIdThe 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
namestringThe name of the medicine to look up.
Returns
- Task<Medicine>
A Task<TResult> that resolves to the matching Medicine, or
nullif 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
filterPaginationFilterThe pagination filter containing the page number and page size used to control the result set.
Returns
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
medicineMedicineThe medicine entity to be created and submitted.
Returns
- Task<Medicine>
A task that resolves to the newly created Medicine, or
nullif the operation does not yield a result.
UpdateMedicine(Medicine)
Updates an existing medicine record with the provided information.
Task<Medicine?> UpdateMedicine(Medicine medicine)
Parameters
medicineMedicineThe medicine entity containing the updated data, typically identified by its primary key.