Example #1
0
        public async Task <IEnumerable <PatientDetailsResult> > PatientDetailsReport(PatientCumulativeResult data)
        {
            // Procedure name: GetPatientDetails
            // use dapper
            string connectionString = configuration.GetConnectionString("Default");

            var commandText = "GetPatientDetails";
            var command     = new CommandDefinition(commandText, new { data.MedicineId, data.PharmacyId, data.PatientId, data.MinDate, data.MaxDate }, commandType: CommandType.StoredProcedure);

            IEnumerable <PatientDetailsResult> result;

            try
            {
                using SqlConnection connection = new SqlConnection(connectionString);
                result = await connection.QueryAsync <PatientDetailsResult>(command);
            }
            catch (Exception ex)
            {
                logger.LogError(ex.GetExceptionMessage());
                return(null);
            }

            return(result);
        }
Example #2
0
 public async Task <IActionResult> DetailtsReport(PatientCumulativeResult data)
 {
     return(Ok(await repository.PatientDetailsReport(data)));
 }