Example #1
0
        public List <ThreeObjectsModel> GetAllThreeObjects()
        {
            List <ThreeObjectsModel> threeObjectsList = new List <ThreeObjectsModel>();

            List <PersonModel> allPersonsId = personRepository.GetAllPersonsId();

            for (int i = 0; i < allPersonsId.Count; i++)
            {
                ThreeObjectsModel threeObjects = new ThreeObjectsModel();

                PersonModel personModel;

                if (studentRepository.GetOneStudentById(allPersonsId[i].personId) != null)
                {
                    personModel = studentRepository.GetOneStudentById(allPersonsId[i].personId);
                }
                else
                {
                    personModel = teacherRepository.GetOneTeacherById(allPersonsId[i].personId);
                }

                VehicleModel  vehicleModel  = vehicleRepository.GetOneVehicleByOwnerId(allPersonsId[i].personId);
                ApprovalModel approvalModel = approvalRepository.GetOneApprovalByPersonId(allPersonsId[i].personId);

                threeObjects.personModel   = personModel;
                threeObjects.vehicleModel  = vehicleModel;
                threeObjects.approvalModel = approvalModel;

                threeObjectsList.Add(threeObjects);
            }

            return(threeObjectsList);
        }