public async Task ExecuteAsync(UpdateEmailCommand message, CancellationToken token) { var user = await _repository.GetAsync(message.UserId, token); user.ChangeEmail(message.Email); await _repository.UpdateAsync(user, token); }
public async Task ExecuteAsync(UpdateNameCommand message, CancellationToken token) { var user = await _repository.GetAsync(message.UserId, token); user.ChangeName(message.FirstName, message.LastName); await _repository.UpdateAsync(user, token); }
public async Task ExecuteAsync(UpdatePhoneCommand message, CancellationToken token) { var user = await _repository.GetAsync(message.UserId, token); if (user == null) { throw new NotFoundException(); } if (string.IsNullOrEmpty(user.Country)) { throw new NullReferenceException(); } user.PhoneNumber = message.NewPhone; await _repository.UpdateAsync(user, token); }