Beispiel #1
0
        /// <summary>
        /// Gets the AuditLog.
        /// </summary>
        /// <param name="details">The details.</param>
        /// <returns></returns>
        public async Task <APIResponse> GetAuditLog(AuditLogIdDetails details)
        {
            try
            {
                var client = httpClientFactory.CreateClient(AuditLogServiceOperation.serviceName);

                var response = await client.GetAsync(servicesConfig.AuditLog + AuditLogServiceOperation.GetAuditLog(details.Id));

                if (response.IsSuccessStatusCode)
                {
                    var auditLog = JsonConvert.DeserializeObject <AuditLogResponseDetails>(await response.Content.ReadAsStringAsync());
                    return(new APIResponse(auditLog, HttpStatusCode.OK));
                }

                return(new APIResponse(response.StatusCode));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'GetAuditLog()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }