コード例 #1
0
            /// <summary>
            ///     Handle
            /// </summary>
            /// <param name="command"></param>
            /// <param name="cancellationToken"></param>
            /// <returns></returns>
            public async Task <CommandResponse> Handle(DeleteCommand command, CancellationToken cancellationToken)
            {
                CommandResponse response = new CommandResponse();

                Core.Entities.ToDoItem entity = await _repo.GetItemAsync(command.Id);

                if (entity == null)
                {
                    throw new EntityNotFoundException(nameof(ToDoItem), command.Id);
                }

                await _repo.DeleteItemAsync(command.Id);

                return(response);
            }