Exemple #1
0
        public async Task <Instructor> Create(InstructorCreationData data)
        {
            await _registrationValidationService.TrowsIfEmailIsNotUniq(data.Email);

            Account account = await _userAccountService.Create(_mapper.Map <AccountCreationData>(data));

            var instructor = await _unitOfWork.Add(new Instructor
            {
                Account = account,
            });

            await _userAccountService.SendEmailConfirmation(account);

            await _unitOfWork.Commit();

            return(instructor);
        }
Exemple #2
0
        public async Task <Student> Create(StudentCreationData data)
        {
            await _registrationValidationService.TrowsIfEmailIsNotUniq(data.Email);

            Account account = await _userAccountService.Create(_mapper.Map <AccountCreationData>(data));

            var student = await _unitOfWork.Add(new Student
            {
                Account   = account,
                FirstName = data.FirstName,
                LastName  = data.LastName,
                Group     = data.Group,
            });

            await _userAccountService.SendEmailConfirmation(account);

            await _unitOfWork.Commit();

            return(student);
        }