Exemplo n.º 1
0
        public IActionResult CreateKeyByUser(Guid userId, [FromBody] KeyCreationDto key)
        {
            if (key == null)
            {
                return(BadRequest());
            }

            var userFound = _userApplication.Get(userId).Data;

            if (userFound == null)
            {
                return(NotFound());
            }

            var keyDto = _userApplication.CreateKey(userId, key).Data;

            return(CreatedAtRoute("GetKeyForUser", new { userId = keyDto.UserId, keyId = keyDto.Id }, CreateLink(keyDto)));
        }