Example #1
0
        public static HttpResponseMessage DeleteToDo(
            [HttpTrigger(AuthorizationLevel.Anonymous, "delete", Route = "api/todos/{id}")] HttpRequestMessage req,
            string id, [Table("todotable", Connection = "MyTable")] CloudTable table,
            TraceWriter log)
        {
            Stopwatch stopWatch = new Stopwatch();

            table.DeleteToDoFromTable(id);

            stopWatch.Stop();

            var metrics = new Dictionary <string, double> {
                { "processingTime", stopWatch.Elapsed.TotalMilliseconds }
            };

            var props = new Dictionary <string, string> {
                { "todo-id", id }
            };

            TelemetryClient telemetryClient = telemetryFactory.GetClient();

            telemetryClient.TrackEvent("delete-todo", properties: props, metrics: metrics);

            return(req.CreateResponse(HttpStatusCode.OK));
        }