/// <summary> /// RegisterUserAsync with correct model /// and with email which doesn't exist in database /// save to database and send verification email /// </summary> /// <param name="createUserDto"></param> /// <returns>return map createUserDto /// or return not map createUserDto</returns> public async Task <CreateUserDto> RegistrationUserAsync(CreateUserDto createUserDto) { var new_user = new User(createUserDto.FirstName, createUserDto.LastName, createUserDto.IdentificationNumber, createUserDto.Email, createUserDto.MobileNumber); var check_user = await userRepository.FindByLoginAsync(createUserDto.Email); if (check_user == null) { userRepository.Create(new_user); await userRepository.SaveChangesAsync(); createUserDto.CodeOfVerification = new_user.CodeOfVerification; email.EmailAfterRegistration(createUserDto); } else { return(null); } return(mapper.Map <CreateUserDto>(new_user)); }