public async Task <IActionResult> CreatePerson([FromBody] Person person)
        {
            var response = await _cosmosManager.AddPersonData(person);

            if (response == HttpStatusCode.Created)
            {
                return(Ok());
            }
            return(BadRequest("Unable to create the person"));
        }
Beispiel #2
0
        /// <summary>
        /// Register the person
        /// </summary>
        /// <param name="person"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public async Task <Person> Register(Person person, string password)
        {
            byte[] passwordHash, passwordSalt;
            CreatePasswordHash(password, out passwordHash, out passwordSalt);

            person.PasswordHash = passwordHash;
            person.PasswordSalt = passwordSalt;

            var statusCode = await _context.AddPersonData(person);

            if (statusCode == HttpStatusCode.Created)
            {
                return(person);
            }

            return(null);
        }