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); }
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(); }