public async Task <List <Inspection> > GetInspectionsByUserIdAsync(int userId)
        {
            try
            {
                var param = new DynamicParameters();
                param.Add("UserId", userId, dbType: DbType.Int32);
                param.Add("Inspections", dbType: DbType.Xml, direction: ParameterDirection.Output);

                _logger.LogInformation("Calling stored procedure dbo.GetUserPendingInspections with UserId:  {0}", userId);

                var result = await WithConnection(async c =>
                {
                    await c.ExecuteAsync("dbo.GetUserPendingInspections", param, commandType: CommandType.StoredProcedure);
                    return(param.Get <string>("@Inspections"));
                });

                return(_xmlHelper.ConvertFromXml <List <Inspection> >(result));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                throw new Exception(ex.Message);
            }
        }
Example #2
0
 public async Task <Dictionary> GetHmoConfig()
 {
     _logger.LogInformation("Calling GetHmoConfig from ConfigurationsController");
     return(_xmlHelper.ConvertFromXml <Dictionary>(await _configurationsAppService.GetHmoConfigAsync()));
 }