示例#1
0
        public async Task <IActionResult> Post([FromBody] AddGreetingRequest request)
        {
            var newGreetingId      = Guid.NewGuid();
            var addGreetingCommand = new AddGreetingCommand(newGreetingId, request.Message);

            await _commandProcessor.SendAsync(addGreetingCommand);

            var addedGreeting = await _queryProcessor.ExecuteAsync(new GreetingsByIdQuery(newGreetingId));

            return(Ok(addedGreeting));
        }
示例#2
0
        public async Task <IActionResult> Post([FromBody] AddGreetingRequest request)
        {
            var newGreetingId = Guid.NewGuid();
            await _facade.AddAsync(newGreetingId, request.Message);

            await _facade.RegreetAsync(newGreetingId);

            var addedGreeting = await _facade.GetAsync(newGreetingId);

            return(Ok(addedGreeting));
        }