Ejemplo n.º 1
0
        public static Student Create(Guid id, string name, IEnumerable<Course> coursesTaken, bool allowTakeCourse = true)
        {
            id.ThrowIfEmpty("id");
            name.ThrowIfNullOrEmpty("name");
            coursesTaken.ThrowIfNull("coursesTaken");

            try
            {
                Student student = new Student(id, name, coursesTaken, allowTakeCourse);
                return student;
            }
            catch (Exception ex)
            {
                throw new ObjectNotCreatedException("Student", ex);
            }
        }
Ejemplo n.º 2
0
        public static Course Create(Guid id, Teacher teacher, string name, string syllabus, CourseStatus status, DateTimeOffset createdOn)
        {
            id.ThrowIfEmpty("id");
            teacher.ThrowIfNull("teacher");
            name.ThrowIfNullOrEmpty("name");
            syllabus.ThrowIfNullOrEmpty("syllabus");

            try
            {
                Course course = new Course(id, teacher, name, syllabus, status, createdOn);
                return course;
            }
            catch (Exception ex)
            {
                throw new ObjectNotCreatedException("Teacher", ex);
            }
        }