コード例 #1
0
        public async Task SaveAsync(
            Guid entityId,
            string entityType,
            IEnumerable <EntityLogProperty> modifiedProperties,
            Guid organisationId,
            string username)
        {
            var requestModel = new SaveEventApiRequestModel
            {
                EntityId       = entityId,
                EntityType     = entityType,
                Content        = string.Join(",", modifiedProperties.Select(x => x.PropertyName)),
                OldValue       = string.Join(",", modifiedProperties.Select(x => x.OldValue)),
                NewValue       = string.Join(",", modifiedProperties.Select(x => x.NewValue)),
                OrganisationId = organisationId,
                Username       = username
            };

            var apiRequest = new ApiRequest <SaveEventApiRequestModel>
            {
                Data            = requestModel,
                EndpointAddress = $"{this.configuration["EventLoggingUrl"]}{ApiConstants.EventLoggingApiEndpoint}"
            };

            await this.apiClientService.PostAsync <ApiRequest <SaveEventApiRequestModel>, SaveEventApiRequestModel, BaseResponseModel>(apiRequest);
        }
コード例 #2
0
        public async Task SaveAsync(IntegrationEvent @event, string eventState)
        {
            var requestModel = new SaveEventApiRequestModel
            {
                EventId        = @event.Id,
                EventState     = eventState,
                EventName      = @event.EventName,
                Content        = JsonConvert.SerializeObject(@event),
                Username       = @event.Username,
                OrganisationId = @event.OrganisationId,
                Source         = @event.Source,
                IpAddress      = @event.IpAddress
            };

            var apiRequest = new ApiRequest <SaveEventApiRequestModel>
            {
                Data            = requestModel,
                EndpointAddress = $"{this.configuration["EventLoggingUrl"]}{ApiConstants.EventLoggingApiEndpoint}"
            };

            await this.apiClientService.PostAsync <ApiRequest <SaveEventApiRequestModel>, SaveEventApiRequestModel, BaseResponseModel>(apiRequest);
        }