Ejemplo n.º 1
0
        public void DeleteTraining(int trainingId)
        {
            //Check if training is booked by employees and in status in process
            List <TrainingBookingEntry> entries = db.GetBookingsWithStatus(trainingId, (int)TrainingStatus.InProcess);

            //if not, proceed, else throw an exception
            if (entries.Count == 0)
            {
                db.DeleteTraining(trainingId);
                Training.Trainings = db.GetTrainings();
            }
            else
            {
                throw new TrainingPlatformException("There are employee which are currently undergo this training and therefor it can not be deleted.");
            }
        }