Пример #1
0
        public async Task Run(
            [ServiceBusTrigger("ScooterUpdated", "ScooterService", Connection = "ScooterServiceBusConnection", IsSessionsEnabled = true)] Message scooterUpdatedMessage,
            ILogger log)
        {
            log.LogInformation($"C# ServiceBus topic trigger function processed message: {scooterUpdatedMessage.MessageId}");

            try
            {
                var scooterDocument = scooterUpdatedMessage.GetContent <ScooterDocument>();

                // Upsert scooter into database
                await _scooterService.UpdateScooter(scooterDocument);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                log.LogError(e.Message);
                throw;
            }
        }
Пример #2
0
 public void Put([FromBody] Scooter scooter)
 {
     _scooterService.UpdateScooter(scooter);
 }