public async Task AddTestResult(TestResultRequest testResultRequest)
        {
            if (testResultRequest == null || !testResultRequest.isValid())
            {
                throw new ValidationException(Messages.Token_InvaldPayload);
            }

            var wallet = await _walletRepository.GetAsync(testResultRequest.walletId);

            if (wallet == null)
            {
                throw new ValidationException(Messages.Wallet_NotFound);
            }

            var testResults = new WalletTestResult
            {
                Wallet              = wallet,
                Laboratory          = testResultRequest.Laboratory,
                ReferenceNumber     = testResultRequest.ReferenceNumber,
                TestedAt            = testResultRequest.TestedAt,
                ResultStatus        = testResultRequest.ResultStatus,
                LaboratoryStatus    = LaboratoryStatus.Unsent,
                TestType            = TestType.Covid19,
                HasConsent          = testResultRequest.HasConsent,
                PermissionGrantedAt = DateTime.UtcNow
            };

            await _walletTestResultRepository.AddAsync(testResults);

            await _walletTestResultRepository.SaveAsync();
        }
Example #2
0
        public async Task <ActionResult <BaseRespone> > GetUser([FromQuery] TestResultRequest req)
        {
            var data = await(
                from course in _context.Courses
                join entr in _context.EntranceTest on course.CourseId equals entr.COURSEID
                join sjentr in _context.SubjectEntranceTests on entr.Id equals sjentr.ENTRANCETESTID
                join exam in _context.ExaminationSubjects on sjentr.SUBJECTID equals exam.Id
                join test in _context.TestResults on sjentr.ID equals test.Subject_EntranceTestID
                join us in _context.Users on test.UserID equals us.Id
                where course.CourseId == req.CousrseId && entr.Id == req.EntranceId
                select new TestResultUserRespone
            {
                id        = us.Id,
                Firstname = us.FIRSTNAME,
                Lastname  = us.LASTNAME
            }).ToListAsync();

            return(new BaseRespone(data));
        }
Example #3
0
        public async Task <IActionResult> AddTestResult([FromBody] TestResultRequest testResultRequest)
        {
            await _testResultService.AddTestResult(testResultRequest);

            return(Ok(new Response(true, HttpStatusCode.OK)));
        }