0% found this document useful (0 votes)
0 views

test 2

The MedicationController class provides endpoints for managing medications, including retrieving medications by patient ID, name, and type, as well as by disease. It also includes a method to add new medications. The controller utilizes an injected IMedicationServices interface to handle the business logic for these operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

test 2

The MedicationController class provides endpoints for managing medications, including retrieving medications by patient ID, name, and type, as well as by disease. It also includes a method to add new medications. The controller utilizes an injected IMedicationServices interface to handle the business logic for these operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

public class MedicationController : ControllerBase

{
private readonly IMedicationServices _medicationServices;
public MedicationController(IMedicationServices medicationServices)
{
_medicationServices = medicationServices;
}

[HttpGet]
public async Task<object> GetMedications()
{
return await _medicationServices.GetMedications();
}

[HttpGet]
public async Task<object> GetMedicationsByPatientId(int patientId)
{
return _medicationServices.GetMedications(patientId);
}

[HttpGet]
public async Task<object> GetMedicationsByPatientName(string patientName)
{
return await
_medicationServices.GetMedicationsByPatientName(patientName);
}

[HttpGet]
public async Task<object> GetMedicationsByPatientType(string patientType)
{
return _medicationServices.GetMedications(patientType);
}

[HttpPost]
public async Task<object> AddMedication(Medication medication)
{
return await _medicationServices.AddMedication(medication);
}

[HttpGet]
public async Task<object> GetMedicationByDisease(string diseaseName)
{
return _medicationServices.GetMedicationByDisease(diseaseName);
}
}
}

You might also like