コード例 #1
0
        // strictly a command should not return anything, except when not long running
        // https://stackoverflow.com/questions/43433318/cqrs-command-return-values
        // https://lostechies.com/jimmybogard/2013/12/19/put-your-controllers-on-a-diet-posts-and-commands/
        public async Task <ActionResult> UpdateArticle(ArticleForUpdateDto articleUpdateDto)
        {
            var updated = await _updateCommand.Execute(articleUpdateDto);

            if (updated)
            {
                return(NoContent());
            }

            return(BadRequest("Failed to update article"));
        }
コード例 #2
0
        // TODO: restful: also specify id in parm list?
        public async Task <ActionResult> UpdateArticle(ArticleForUpdateDto articleUpdateDto)
        {
            await _updateCommand.Execute(articleUpdateDto);

            return(NoContent());

            // TODO: handle errors

            //if (await _unitOfWork.Commit()) return NoContent();

            //return BadRequest("Failed to update article");
        }