private async Task <InstructorProfile> GetInstructorDetails(string publicName) { var profile = await _mediator.Send(new GetAppProfileByPublicNameQuery(publicName)); var instructor = InstructorProfile.Create(profile.PersonalDetails.UserId, profile.Id, profile.PersonalDetails.FirstName, profile.PersonalDetails.LastName, profile.PersonalDetails.Email, profile.PersonalDetails.ScreenName, profile.AppDetails.InstructorDetails.PublicName); return(instructor); }
private async Task <InstructorProfile> GetInstructorDetails(string userId) { Profile profile = null; while (profile == null) { profile = await _mediator.Send(new GetAppProfileByUserIdQuery(userId)); Thread.Sleep(1000); } var instructor = InstructorProfile.Create(profile.PersonalDetails.UserId, profile.Id, profile.PersonalDetails.FirstName, profile.PersonalDetails.LastName, profile.PersonalDetails.Email, profile.PersonalDetails.ScreenName, profile.AppDetails.InstructorDetails.PublicName); return(instructor); }
public async Task OnGet(string publicName, string code = null) { var newUserCommand = new RegisterNewUserCommand(); // if publicName is NOT empty, then this is a student registration with a specific instructor if (!string.IsNullOrEmpty(publicName)) { if (publicName.Trim().ToUpper() == "INSTRUCTOR") { // code should be passed from the invitation email link if (code != null) { newUserCommand.EntryCode = code; } } else { // check if publicName maps to instructor profile Instructor = await GetInstructorDetails(publicName); // if yes if (Instructor != null) { // code should be passed from the invitation email link if (code != null) { newUserCommand.EntryCode = code; } newUserCommand.InstructorId = Instructor.ProfileId; } else { // instructor doesn't exist so user is going to be registered as an invited instructor or uninvited user // do nothing } } } else { // this is could be an invited instructor registering // or it's an uninvited user who found the registration page and is attempting to register // do nothing } Data = newUserCommand; }