Пример #1
0
        public static async Task CancelPatientExAsync(int id)
        {
            PatientExamination patientExamination = await _context.PatientExaminations.FindAsync(id);

            if (await _context.ExaminationReagents.Where(e => e.ExaminationID == patientExamination.ExaminationID).AnyAsync())
            {
                await ReagentHelper.IncreaseReagentsAsync(patientExamination.ExaminationID);
            }

            _context.PatientExaminations.Remove(patientExamination);
            await _context.SaveChangesAsync();
        }
Пример #2
0
        public static async Task <int> AddPatientExAsync(PatientExaminationViewModel patientExaminationVM)
        {
            PatientExamination patientExamination = SimplifyPE(patientExaminationVM);

            _context.PatientExaminations.Add(patientExamination);

            if (await _context.ExaminationReagents.Where(e => e.ExaminationID == patientExamination.ExaminationID).AnyAsync())
            {
                ReagentHelper.Init(_context);
                await ReagentHelper.ReduceReagentsAsync(patientExamination.ExaminationID);
            }

            await _context.SaveChangesAsync();

            return(patientExamination.ID);
        }