Exemplo n.º 1
0
        public async Task <IActionResult> Put(
            [HttpTrigger(AuthorizationLevel.Function, "put", Route = "data/projectTypes")] ProjectTypeDocument projectType)
        {
            if (projectType is null)
            {
                throw new ArgumentNullException(nameof(projectType));
            }

            var newProjectType = await projectTypesRepository
                                 .SetAsync(projectType)
                                 .ConfigureAwait(false);

            return(new OkObjectResult(newProjectType));
        }
Exemplo n.º 2
0
        public async Task <ICommandResult> HandleAsync(OrchestratorProjectTypeUpdateCommand orchestratorCommand, IDurableClient durableClient = null)
        {
            if (orchestratorCommand is null)
            {
                throw new ArgumentNullException(nameof(orchestratorCommand));
            }

            var commandResult = orchestratorCommand.CreateResult();

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

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

            return(commandResult);
        }