コード例 #1
0
        public async Task <Unit> Handle(EditSubItem request, CancellationToken cancellationToken)
        {
            var subItem = await _subItemRepository.FindByIdAsync(request.SubItemId);

            subItem.Name = request.Name;
            subItem.EditSubItem(subItem);

            await _subItemRepository.SaveChangesAsync();

            return(Unit.Value);
        }
コード例 #2
0
        protected override async Task Handle(SubItemCompletedState request, CancellationToken cancellationToken)
        {
            var subItem = await _subItems.FindByIdAsync(request.SubItemId);

            if (request.Completed)
            {
                subItem.SetCompleted();
            }

            else
            {
                subItem.SetNotCompleted();
            }

            await _subItems.SaveChangesAsync();
        }