Esempio n. 1
0
        public async Task <MappedStudent> Create(string firstName, string lastName, string email, string phoneNumber, string numericCode)
        {
            var claims = new Dictionary <string, object>()
            {
                { "student", true },
            };
            UserRecord newStudentResult = await firebaseService.CreateFirebaseAccount(email, numericCode, claims);

            Student createdStudent = studentRepository.Create(Student.Create(newStudentResult.Uid, firstName, lastName, email, phoneNumber, numericCode));

            studentRepository.Save();
            if (createdStudent != null)
            {
                return(createdStudent.Map());
            }
            return(null);
        }
Esempio n. 2
0
        public async Task <MappedTeacher> CreateTeacherAccount(string firstName, string lastName, string email, int age)
        {
            var claims = new Dictionary <string, object>()
            {
                { "teacher", true },
            };
            UserRecord newteacherResult = await firebaseService.CreateFirebaseAccount(email, "teacherPassword123", claims);

            Teacher createdTeacher = teacherRepository.Create(Teacher.CreateTeacher(newteacherResult.Uid, firstName, lastName, email, age));

            teacherRepository.Save();
            if (teacherRepository != null)
            {
                return(createdTeacher.MapWithoutCourses());
            }
            return(null);
        }