예제 #1
0
        public ResultCode AddSchoolWithDetails(school schoolOb)
        {
            school schoolDetails = new school {
                Address = schoolOb.Address, Name = schoolOb.Name
            };

            List <Teacher> teachers = new List <Teacher>();

            if (schoolOb.Teachers.Count > 0)
            {
                schoolOb.Teachers?.ForEach(teacher =>
                {
                    teachers.Add(teacher);
                });
            }

            List <Pupil> pupils = new List <Pupil>();

            if (schoolOb.Pupils.Count > 0)
            {
                schoolOb.Pupils?.ForEach(pupil =>
                {
                    pupils.Add(pupil);
                });
            }

            List <Admin> admins = new List <Admin>();

            if (schoolOb.Admins.Count > 0)
            {
                schoolOb.Admins?.ForEach(adminItem =>
                {
                    admins.Add(adminItem);
                });
            }
            return(AdminDB.AddSchoolWithDetails(schoolDetails, teachers, pupils, admins));
        }