示例#1
0
        public async Task <ActionResult <VerifySecurityPhraseResponse> > VerifySecurityPhrase(string fileId, VerifySecurityPhraseRequest request)
        {
            var verifySecurityPhraseQuery = new VerifySecurityPhraseQuery {
                FileId = fileId, SecurityPhrase = request.Answer
            };
            var response = await messagingClient.Send(verifySecurityPhraseQuery);

            return(Ok(mapper.Map <VerifySecurityPhraseResponse>(response)));
        }
示例#2
0
        public async Task <VerifySecurityPhraseResponse> Handle(VerifySecurityPhraseQuery query)
        {
            var file = (await caseRepository.QueryCase(new Resources.Cases.EvacuationFilesQuery
            {
                FileId = query.FileId,
                MaskSecurityPhrase = false
            })).Items.Cast <Resources.Cases.Evacuations.EvacuationFile>().FirstOrDefault();

            if (file == null)
            {
                throw new NotFoundException($"Evacuation File {query.FileId} not found", query.FileId);
            }

            var isCorrect = string.Equals(file.SecurityPhrase, query.SecurityPhrase, StringComparison.OrdinalIgnoreCase);

            return(new VerifySecurityPhraseResponse
            {
                IsCorrect = isCorrect
            });
        }