public async Task <IHttpActionResult> PutTelemetry(PutTelemetryRequest putTelemetryRequest)
        {
            var clientAddress = HttpContext.Current.Request.UserHostAddress;

            putTelemetryRequest.UserIPAddress = clientAddress;

            await this.telemetryService.PutTelemetry(putTelemetryRequest);

            return(this.Ok());
        }
Пример #2
0
        public async Task PutTelemetry(PutTelemetryRequest putTelemetryRequest)
        {
            try
            {
                using (var client = this.CreateClient())
                {
                    var json = JsonConvert.SerializeObject(putTelemetryRequest);

                    await PostAsync(client, "PutTelemetry", json);
                }
            }
            catch (Exception exception)
            {
                throw new WebServiceException(exception.Message, exception);
            }
        }
Пример #3
0
        public async Task PutTelemetry(PutTelemetryRequest putTelemetryRequest)
        {
            using (var context = this.CreateContext())
            {
                var telemetry = context.Telemetries.Create();
                telemetry.Action              = putTelemetryRequest.Action;
                telemetry.DateUtc             = DateTime.UtcNow;
                telemetry.Payload             = putTelemetryRequest.Payload;
                telemetry.PluginVersion       = putTelemetryRequest.PluginVersion;
                telemetry.UserIPAddress       = putTelemetryRequest.UserIPAddress;
                telemetry.UserName            = putTelemetryRequest.UserName;
                telemetry.UserMachineName     = putTelemetryRequest.UserMachineName;
                telemetry.VisualStudioVersion = putTelemetryRequest.VisualStudioVersion;

                context.Telemetries.Add(telemetry);

                await context.SaveChangesAsync();
            }
        }