public async Task CreateUserDueAsync(CreateDueCommand createDueCommand, CancellationToken cancellationToken) { var user = await _userRepository.GetAsync(createDueCommand.UserId, cancellationToken); user.AddDue(createDueCommand.Half, createDueCommand.Amount); _userRepository.Update(user); await _userRepository.SaveAsync(cancellationToken); }
public async Task <IActionResult> CreateUserDueAsync( [FromRoute] Guid userId, [FromBody] CreateDueCommand createDueCommand, CancellationToken cancellationToken) { createDueCommand.UserId = userId; await _userHandler.CreateUserDueAsync(createDueCommand, cancellationToken); return(Ok()); }