Пример #1
0
        public async Task <IActionResult> Put(
            [HttpTrigger(AuthorizationLevel.Function, "put", Route = "data/providerData")] ProviderDataDocument providerData)
        {
            if (providerData is null)
            {
                throw new ArgumentNullException(nameof(providerData));
            }

            var newProviderData = await providerDataRepository
                                  .SetAsync(providerData)
                                  .ConfigureAwait(false);

            return(new OkObjectResult(newProviderData));
        }
        public async Task <ICommandResult> HandleAsync(OrchestratorProviderDataUpdateCommand orchestratorCommand, IDurableClient durableClient = null)
        {
            if (orchestratorCommand is null)
            {
                throw new ArgumentNullException(nameof(orchestratorCommand));
            }

            var commandResult = orchestratorCommand.CreateResult();

            try
            {
                commandResult.Result = await providerDataRepository
                                       .SetAsync(orchestratorCommand.Payload)
                                       .ConfigureAwait(false);

                commandResult.RuntimeStatus = CommandRuntimeStatus.Completed;
            }
            catch (Exception exc)
            {
                commandResult.Errors.Add(exc);
            }

            return(commandResult);
        }