public async Task <IActionResult> Post([FromBody] newHumanRequest data)
 {
     if (!await _service.isHumanNew(data.email))
     {
         return(Conflict("existing human"));
     }
     else
     {
         return(Ok(await _service.addNewHuman(data)));
     }
 }
Ejemplo n.º 2
0
        public async Task <newHumanResponse> addNewHuman(newHumanRequest userRequest)
        {
            var newHuman = new human <long>()
            {
                email    = userRequest.email,
                password = userRequest.passwordHash
            };

            newHuman = await _humanRepository.addNewHuman(newHuman);

            newHuman.password = null;

            var verificationKey = getUniqueVerificationKey();

            await _verificationKeyRepository.linkVerification(newHuman.humanId, verificationKey);

            var newHumanResponse = new newHumanResponse
            {
                email            = newHuman.email,
                verificationCode = verificationKey
            };

            return(newHumanResponse);
        }