Esempio n. 1
0
        private async Task HandleCreate(V1.RegisterUser cmd)
        {
            if (await _repository.Exists(new Domain.UserId(cmd.UserId)))
            {
                throw new InvalidOperationException($"Entity with id {cmd.UserId} already existes");
            }

            var userProfile = new Domain.UserProfile.UserProfile(new Domain.UserId(cmd.UserId), FullName.FromString(cmd.FullName), DisplayName.FromString(cmd.DisplayName, _checkText));

            await _repository.Add(userProfile);

            await _unitOfWork.Commit();
        }
Esempio n. 2
0
 public Task <IActionResult> Post([FromBody] V1.RegisterUser request)
 => HandleCommand(request);