예제 #1
0
        public async Task <(Result Result, string id)> CreateStudentAsync(StudentSignupCommand studentSignUp)
        {
            var user = new ApplicationUser
            {
                Name             = studentSignUp.Name,
                PhoneNumber      = studentSignUp.PhoneNumber,
                Email            = studentSignUp.Email,
                UserName         = studentSignUp.Email,
                UserType         = UserType.Student,
                AcceptanceStatus = Domain.Enums.AcceptanceStatus.Pending,
                DateOfBirth      = studentSignUp.DateOfBirth
            };
            var result = await _userManager.CreateAsync(user, studentSignUp.Password);

            string userId = null;

            if (result.Succeeded)
            {
                userId = user.Id;
                await _userManager.AddToRoleAsync(user, UserType.Student.ToString());
            }
            return(result.ToApplicationResult(), userId);
        }
 public async Task <StudentSignupResult> UserSignUp(StudentSignupCommand command)
 {
     return(await Mediator.Send(command));
 }