public async Task <IActionResult> PostRevokeBatch([FromBody] RevokeBatchInput revokeBatchInput)
        {
            var infectionConfirmationCodeEntity = await _IccService.RedeemIcc(User.Identity.Name);

            bool result = await _IccService.RevokeBatch(revokeBatchInput);

            _DbContext.SaveAndCommit();

            if (result)
            {
                return(new OkResult());
            }
            return(NotFound(new
            {
                ok = false,
                status = 404,
                message = "Batch not found."
            }));
        }
Exemplo n.º 2
0
        public async Task <bool> RevokeBatch(RevokeBatchInput revokeBatchInput)
        {
            List <InfectionConfirmationCodeEntity> iccList =
                await _DbContext.InfectionConfirmationCodes.Where(i => i.BatchId == revokeBatchInput.BatchId)
                .ToListAsync();

            if (iccList.Count > 0)
            {
                foreach (InfectionConfirmationCodeEntity infectionConfirmationCodeEntity in iccList)
                {
                    infectionConfirmationCodeEntity.Revoked =
                        revokeBatchInput.RevokeDateTime ?? _DateTimeProvider.Now();
                }

                return(true);
            }

            return(false);
        }