示例#1
0
        private async Task GetProctors()
        {
            var(ret, proctors) = await ExamServices.GetProctors(_examId);

            if (ret == ErrorCodes.Success)
            {
                _proctors = proctors.Select(x => x.Id).ToList();
            }
        }
示例#2
0
        protected override async Task OnInitializedAsync()
        {
            if (!int.TryParse(ExamId, out _examId))
            {
                await Modal.ErrorAsync(new ConfirmOptions()
                {
                    Title = "Invalid exam ID"
                });

                return;
            }

            var(res, details) = await ExamServices.GetExamDetails(_examId);

            if (res != ErrorCodes.Success)
            {
                await Modal.ErrorAsync(new ConfirmOptions()
                {
                    Title   = "Failed to obtain exam information",
                    Content = ErrorCodes.MessageMap[res]
                });

                return;
            }

            _model = details;

            var(res2, takers) = await ExamServices.GetTestTakers(_examId);

            if (res2 != ErrorCodes.Success)
            {
                await Modal.ErrorAsync(new ConfirmOptions()
                {
                    Title   = "Failed to obtain list of exam takers",
                    Content = ErrorCodes.MessageMap[res2]
                });

                return;
            }

            _takers = takers;

            var(res3, proctors) = await ExamServices.GetProctors(_examId);

            if (res3 != ErrorCodes.Success)
            {
                await Modal.ErrorAsync(new ConfirmOptions()
                {
                    Title   = "Failed to obtain list of exam proctors",
                    Content = ErrorCodes.MessageMap[res3]
                });

                return;
            }

            _proctors = proctors;

            var(res4, questions) = await ExamServices.GetPaper(_examId);

            if (res4 != ErrorCodes.Success)
            {
                await Modal.ErrorAsync(new ConfirmOptions()
                {
                    Title   = "Failed to obtain questions",
                    Content = ErrorCodes.MessageMap[res4]
                });

                return;
            }

            _questions = questions;
        }