Пример #1
0
        /// <summary>
        /// Generate Icc with configuration length and A-Z, 0-9 characters
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="save"></param>
        /// <param name="batchId"></param>
        /// <returns></returns>
        public async Task <InfectionConfirmationCodeEntity> GenerateIcc(string userId, string batchId)
        {
            var length       = Convert.ToInt32(_Configuration.GetSection("IccConfig:Code:Length").Value);
            var generatedIcc = _RandomGenerator.GenerateToken(length);

            var icc = new InfectionConfirmationCodeEntity
            {
                Code = generatedIcc, GeneratedBy = userId, Created = _DateTimeProvider.Now(), BatchId = batchId
            };


            await _DbContext.InfectionConfirmationCodes.AddAsync(icc);

            return(icc);
        }