public UserModel CreateNewStandardUser(string localAuthId, string userName, string email, RegisterUserModelBase model = null) { var userModel = CreateNewUser(localAuthId, userName, email, UserTypeEnum.Standard, model); return(userModel); }
private UserModel CreateNewUser(string localAuthId, string userName, string email, UserTypeEnum userType, RegisterUserModelBase model = null) { try { User user = new User(); user.LocalAuthUserId = localAuthId; user.UserType = userType; user.UserName = userName; user.Email = email; user.BadgeStrList = "1,"; if (model != null) { user.Profile = new Profile(); MappingUtil.Map(model, user.Profile); //user.Profile.ProfileImageUrl = "Content/images/Icons/default-profile-1.0.jpg"; user.Profile.ProfileImageUrl = "Content/images/" + localAuthId + "/default-profile-1.0.jpg"; } Utilities.ImageUtil.CreateDefaultProfilePix(localAuthId); if (userType == UserTypeEnum.Child) { AddDependentRelationshipToCurrentUser(user); AddQuizzmateRelationshipToCurrentUser(user); } _uow.Users.Add(user); _uow.SaveChanges(); var userModel = MappingUtil.Map <User, UserModel>(user); return(userModel); } catch (Exception ex) { _svcContainer.LoggingSvc.Log(ex); return(null); } }