public async Task Consume(ConsumeContext <IExamUpdated> context)
        {
            var forms = context.Message.AnswerKeyOpticalForms;

            foreach (var form in forms)
            {
                form.ExamId     = context.Message.ExamId;
                form.ExamDate   = context.Message.ExamDate;
                form.ExamName   = context.Message.ExamName;
                form.SharedExam = context.Message.Shared;
                form.IncorrectEliminationRate = context.Message.IncorrectEliminationRate;
            }

            await _answerKeyOpticalFormRepository.DeleteByExamIdAsync(context.Message.ExamId);

            await _answerKeyOpticalFormRepository.AddManyAsync(forms);

            if (_evaluateExamConsumer != null)
            {
                await _evaluateExamConsumer.ConsumeAsync(context.Message.ExamId);
            }
        }
Esempio n. 2
0
        public async Task Consume(ConsumeContext <IExamDeleted> context)
        {
            await _answerKeyOpticalFormRepository.DeleteByExamIdAsync(context.Message.ExamId);

            await _studentOpticalFormRepository.DeleteByExamIdAsync(context.Message.ExamId);
        }