internal Drug Approve(int drugId, int doctorId) { Drug drug = Get(drugId); Doctor doctor = _doctorService.Get(doctorId); if (drug == null || doctor == null) { return(null); } if (!drug.ApprovedByDoctor.Contains(doctor.Id)) { return(null); } drug.ApprovalCount++; _doctorService.Update(doctor); if (drug.ApprovalCount >= 2) { drug.Approved = true; } return(Update(drug)); }
internal Employee Get(int id) { Secretary secretary = _secretaryRepository.Get(id); if (secretary != null) { return(secretary); } Doctor doctor = _doctorService.Get(id); if (doctor != null) { return(doctor); } return(_managerRepository.Get(id)); }