public async Task <ActionResult <bool> > UploadPhoto() { try { int userId = 0; foreach (string key in Request.Form.Keys) { if (key.StartsWith("userId")) { userId = Convert.ToInt32(Request.Form[key]); } } var token = ExtractHeader(HttpContext, "Authorization", ',', 1); var claims = new List <BusinessModels.UserAccessControl.UserClaimModel>(); claims.Add(new BusinessModels.UserAccessControl.UserClaimModel("Id", userId.ToString())); var accessPolicy = _authorizationPolicyManager.ConfigureCustomPolicy(new List <string>() { "user_profile.photo:upload", }, claims); if (!_authorizationResolutionManager.Authorize(token, accessPolicy)) { return(StatusCode(403)); } var postedFile = Request.Form.Files[0]; var uploadFolder = Path.Combine("..\\IntelligentMatcherFrontend\\intelligent-matcher-web-ui\\public\\uploaded"); if (postedFile.Length > 0) { var fileName = ContentDispositionHeaderValue.Parse(postedFile.ContentDisposition) .FileName.Trim('"'); string[] filetype = fileName.Split("."); if (filetype[filetype.Length - 1].ToLower() == "png" || filetype[filetype.Length - 1].ToLower() == "jpg" || filetype[filetype.Length - 1].ToLower() == "jpeg") { string newFileName = userId.ToString() + "profileImage." + filetype[filetype.Length - 1]; var finalPath = Path.Combine(uploadFolder, newFileName); using (var fileStream = new FileStream(finalPath, FileMode.Create)) { postedFile.CopyTo(fileStream); } PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; model.Photo = newFileName; await _publicUserProfileManager.EditUserProfilePictureAsync(model); return(Ok(true)); } else { return(Ok(false)); } } else { return(Ok(false)); } } catch { return(Ok(false)); } }
public async Task <bool> CeatePublicUserProfileAsync(PublicUserProfileModel model) { model.Status = "Offline"; model.Visibility = "Public"; return(await _publicUserProfileService.CeatePublicUserProfileAsync(model)); }
public async Task editUserProfilePicture_EditPhoto_PhotoSuccessfullyEdited(int userId, string photo) { Mock <IPublicUserProfileService> publicUserProfilervice = new Mock <IPublicUserProfileService>(); IPublicUserProfileManager publicUserProfileManager = new PublicUserProfileManager(publicUserProfilervice.Object); PublicUserProfileModel model = new PublicUserProfileModel(); try { model.UserId = userId; await publicUserProfileManager.CeatePublicUserProfileAsync(model); model.Photo = photo; await publicUserProfileManager.EditUserProfilePictureAsync(model); Assert.IsTrue(true); } catch { Assert.IsTrue(false); } }
public async Task UpdateProfileHeightAsync_UpdateValue_ValueUpdated(int userId, string testValue) { Mock <IPublicUserProfileRepo> publicUserProfileRepo = new Mock <IPublicUserProfileRepo>(); Mock <IValidationService> validationService = new Mock <IValidationService>(); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo.Object, validationService.Object); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; try { await publicUserProfileService.CeatePublicUserProfileAsync(model); model.Height = testValue; await publicUserProfileService.UpdateProfileHeightAsync(model); Assert.IsTrue(true); } catch { Assert.IsTrue(false); } }
public async Task GetUserProfileAsync_UserProfileGot_SuccessfulRecieved(int userId) { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; try { await publicUserProfileService.CeatePublicUserProfileAsync(model); Assert.IsTrue(true); } catch { Assert.IsTrue(false); } }
public async Task editPublicUserProfileAsync_EditProfile_ProfileSuccessfullyEdited(int userId, string description, string job, string goals, int age, string gender, string ethnicity, string sexualOrientation, string height, string visibility, string status, string photo, string intrests, string hobbies) { Mock <IPublicUserProfileService> publicUserProfilervice = new Mock <IPublicUserProfileService>(); IPublicUserProfileManager publicUserProfileManager = new PublicUserProfileManager(publicUserProfilervice.Object); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; await publicUserProfileManager.CeatePublicUserProfileAsync(model); model.Description = description; model.Jobs = job; model.Goals = goals; model.Age = age; model.Ethnicity = ethnicity; model.SexualOrientation = sexualOrientation; model.Height = height; model.Visibility = visibility; model.Status = status; model.Photo = photo; model.Intrests = intrests; model.Hobbies = hobbies; try { await publicUserProfileManager.EditPublicUserProfileAsync(model); Assert.IsTrue(true); } catch { Assert.IsTrue(false); } }
public async Task setUserOffline_SetOffline_UserSetOffline(int userId) { Mock <IPublicUserProfileService> publicUserProfilervice = new Mock <IPublicUserProfileService>(); IPublicUserProfileManager publicUserProfileManager = new PublicUserProfileManager(publicUserProfilervice.Object); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; try { await publicUserProfileManager.CeatePublicUserProfileAsync(model); await publicUserProfileManager.SetUserOnlineAsync(userId); await publicUserProfileManager.SetUserOfflineAsync(userId); Assert.IsTrue(true); } catch { Assert.IsTrue(false); } }
public async Task <int> CreatePublicProfile(PublicUserProfileModel model) { var storedProcedure = "dbo.PublicUserProfile_Create"; DynamicParameters p = new DynamicParameters(); p.Add("UserId", model.UserId); p.Add("Description", model.Description); p.Add("Intrests", model.Intrests); p.Add("Hobbies", model.Hobbies); p.Add("Jobs", model.Jobs); p.Add("Goals", model.Goals); p.Add("Age", model.Age); p.Add("Gender", model.Gender); p.Add("Ethnicity", model.Ethnicity); p.Add("SexualOrientation", model.SexualOrientation); p.Add("Height", model.Height); p.Add("Visibility", model.Visibility); p.Add("Status", model.Status); p.Add("Photo", model.Photo); p.Add("Id", DbType.Int32, direction: ParameterDirection.Output); await _dataGateway.Execute(storedProcedure, p, _connectionString.SqlConnectionString); return(p.Get <int>("Id")); }
public async Task <IEnumerable <FriendListModel> > GetAllRequestsOutgoingAsync(int userId) { IEnumerable <FriendsListJunctionModel> junctionModel = await _userInteractionService.GetAllUserFriendRequestsOutgoing(userId); List <FriendListModel> friendListModel = new List <FriendListModel>(); foreach (var junction in junctionModel) { FriendListModel model = new FriendListModel(); if (userId == junction.User1Id) { model.userId = junction.User2Id; } else { model.userId = junction.User1Id; } PublicUserProfileModel publicUserProfileModel = await _publicUserProfileService.GetUserProfileAsync(model.userId); model.userProfileImage = publicUserProfileModel.Photo; UserAccountModel userAccount = await _userAccountRepository.GetAccountById(model.userId); model.username = userAccount.Username; model.date = DateTime.UtcNow; model.status = publicUserProfileModel.Status; friendListModel.Add(model); } return(friendListModel); }
public async Task UpdateProfileAgeAsync_UpdateValue_ValueUpdated(int userId, int age) { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; try { await publicUserProfileService.CeatePublicUserProfileAsync(model); model.Age = age; await publicUserProfileService.UpdateProfileAgeAsync(model); Assert.IsTrue(true); } catch { Assert.IsTrue(false); } }
public async Task ChangeProfilePictureAsync_EditPhoto_PhotoSuccessfullyEdited(int userId, string photo) { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService); PublicUserProfileModel model = new PublicUserProfileModel(); try { model.UserId = userId; await publicUserProfileService.CeatePublicUserProfileAsync(model); model.Photo = photo; await publicUserProfileService.ChangeProfilePictureAsync(model); Assert.IsTrue(true); } catch { Assert.IsTrue(false); } }
public async Task GetUserProfile_GetsProfile_ProfileGetSuccess(int userId, string description, string job, string goals, int age, string gender, string ethnicity, string sexualOrientation, string height, string visibility, string status, string photo, string intrests, string hobbies) { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService); PublicUserProfileManager publicUserProfileManager = new PublicUserProfileManager(publicUserProfileService); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; try { await publicUserProfileManager.CeatePublicUserProfileAsync(model); model.Description = description; model.Jobs = job; model.Goals = goals; model.Age = age; model.Gender = gender; model.Ethnicity = ethnicity; model.SexualOrientation = sexualOrientation; model.Height = height; model.Status = status; model.Photo = photo; model.Intrests = intrests; model.Hobbies = hobbies; await publicUserProfileManager.EditPublicUserProfileAsync(model); PublicUserProfileModel profile = await publicUserProfileManager.GetUserProfileAsync(userId); if (profile == null) { Assert.IsTrue(false); } if (profile.Description == description && profile.Hobbies == hobbies && profile.Jobs == job && profile.Goals == goals && profile.Age == age && profile.Gender == gender && profile.Ethnicity == ethnicity && profile.SexualOrientation == sexualOrientation && profile.Height == height && profile.Visibility == visibility && profile.Intrests == intrests) { Assert.IsTrue(true); } else { Assert.IsTrue(false); } } catch { Assert.IsTrue(false); } }
public async Task <IEnumerable <FriendListModel> > GetMutualFriends(int userId1, int userId2) { IEnumerable <FriendsListJunctionModel> junctionModel1 = await _userInteractionService.GetAllUserFriends(userId1); IEnumerable <FriendsListJunctionModel> junctionModel2 = await _userInteractionService.GetAllUserFriends(userId2); List <FriendsListJunctionModel> junctionModel = new List <FriendsListJunctionModel>(); foreach (var user1 in junctionModel1) { foreach (var user2 in junctionModel2) { if (user1.User2Id == user2.User2Id) { junctionModel.Add(user1); } if (user1.User1Id == user2.User2Id) { junctionModel.Add(user1); } if (user1.User2Id == user2.User1Id) { junctionModel.Add(user1); } } } List <FriendListModel> friendListModel = new List <FriendListModel>(); foreach (var junction in junctionModel) { if ((junction.User1Id != userId1 && junction.User2Id != userId2) || (junction.User2Id != userId1 && junction.User1Id != userId2)) { FriendListModel model = new FriendListModel(); model.userId = junction.User2Id; UserAccountModel userAccount = await _userAccountRepository.GetAccountById(model.userId); PublicUserProfileModel publicUserProfileModel = await _publicUserProfileService.GetUserProfileAsync(model.userId); model.userProfileImage = publicUserProfileModel.Photo; model.username = userAccount.Username; model.date = DateTime.UtcNow; model.status = publicUserProfileModel.Status; if (model.userId != userId1 && model.userId != userId2) { friendListModel.Add(model); } } } return(friendListModel); }
public async Task setUserOnline_SetOnline_UserSetOnline(int userId) { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService); PublicUserProfileManager publicUserProfileManager = new PublicUserProfileManager(publicUserProfileService); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; try { await publicUserProfileManager.CeatePublicUserProfileAsync(model); await publicUserProfileManager.SetUserOnlineAsync(userId); IEnumerable <PublicUserProfileModel> models = await publicUserProfileRepo.GetAllPublicProfiles(); if (models == null) { Assert.IsTrue(false); } if (models.Count() == 0) { Assert.IsTrue(false); } foreach (var profile in models) { if (profile.Status == "Online") { Assert.IsTrue(true); } else { Assert.IsTrue(false); } } } catch { Assert.IsTrue(false); } }
public async Task UpdateProfileDescriptionAsync_UpdateValue_ValueUpdated(int userId, string description) { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; try { await publicUserProfileService.CeatePublicUserProfileAsync(model); model.Description = description; await publicUserProfileService.UpdateProfileDescriptionAsync(model); IEnumerable <PublicUserProfileModel> models = await publicUserProfileRepo.GetAllPublicProfiles(); if (models == null) { Assert.IsTrue(false); } if (models.Count() == 0) { Assert.IsTrue(false); } foreach (var profile in models) { if (profile.Description == description) { Assert.IsTrue(true); } else { Assert.IsTrue(false); } } } catch { Assert.IsTrue(false); } }
public async Task editUserProfilePicture_EditPhoto_PhotoSuccessfullyEdited(int userId, string photo) { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService); PublicUserProfileManager publicUserProfileManager = new PublicUserProfileManager(publicUserProfileService); PublicUserProfileModel model = new PublicUserProfileModel(); try { model.UserId = userId; await publicUserProfileManager.CeatePublicUserProfileAsync(model); model.Photo = photo; await publicUserProfileManager.EditUserProfilePictureAsync(model); IEnumerable <PublicUserProfileModel> models = await publicUserProfileRepo.GetAllPublicProfiles(); if (models == null) { Assert.IsTrue(false); } if (models.Count() == 0) { Assert.IsTrue(false); } foreach (var profile in models) { if (profile.Photo == photo) { Assert.IsTrue(true); } else { Assert.IsTrue(false); } } } catch { Assert.IsTrue(false); } }
public async Task <bool> CeatePublicUserProfileAsync(PublicUserProfileModel model) { if (_validationService.IsNull(model)) { try { await _publicUserProfileRepo.CreatePublicProfile(model); return(true); } catch { return(false); } } return(false); }
public async Task createPublicUserProfileAsync_UserProfileCreated_SuccessfulCreation(int userId) { Mock <IPublicUserProfileService> publicUserProfilervice = new Mock <IPublicUserProfileService>(); IPublicUserProfileManager publicUserProfileManager = new PublicUserProfileManager(publicUserProfilervice.Object); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; try { await publicUserProfileManager.CeatePublicUserProfileAsync(model); Assert.IsTrue(true); } catch { Assert.IsTrue(false); } }
public async Task createPublicUserProfileAsync_UserProfileCreated_SuccessfulCreation(int userId) { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService); PublicUserProfileManager publicUserProfileManager = new PublicUserProfileManager(publicUserProfileService); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; try { await publicUserProfileManager.CeatePublicUserProfileAsync(model); PublicUserProfileModel profile = await publicUserProfileManager.GetUserProfileAsync(userId); if (profile == null) { Assert.IsTrue(false); } if (profile.UserId == userId) { Assert.IsTrue(true); } else { Assert.IsTrue(false); } } catch { Assert.IsTrue(false); } }
public async Task <bool> UpdateProfileSexualOrientationAsync(PublicUserProfileModel model) { if (_validationService.IsNull(model)) { try { int result = await _publicUserProfileRepo.UpdateSexualOrientation(model.UserId, model.SexualOrientation); if (result != 1) { return(false); } return(true); } catch { return(false); } } return(false); }
public async Task <bool> UpdateProfileVisibilityAsync(PublicUserProfileModel model) { if (_validationService.IsNull(model)) { try { int result = await _publicUserProfileRepo.UpdateVisibility(model.UserId, model.Visibility); if (result != 1) { return(false); } return(true); } catch { return(false); } } return(false); }
public async Task <bool> ChangeProfilePictureAsync(PublicUserProfileModel model) { if (_validationService.IsNull(model)) { try { int result = await _publicUserProfileRepo.UpdatePhoto(model.UserId, model.Photo); if (result != 1) { return(false); } return(true); } catch { return(false); } } return(false); }
public async Task <ActionResult <bool> > SaveUserProfile([FromBody] PublicUserProfileModel model) { try { var token = ExtractHeader(HttpContext, "Authorization", ',', 1); var claims = new List <BusinessModels.UserAccessControl.UserClaimModel>(); claims.Add(new BusinessModels.UserAccessControl.UserClaimModel("Id", model.UserId.ToString())); var accessPolicy = _authorizationPolicyManager.ConfigureCustomPolicy(new List <string>() { "user_profile:write" }, claims); if (!_authorizationResolutionManager.Authorize(token, accessPolicy)) { return(StatusCode(403)); } await _publicUserProfileManager.EditPublicUserProfileAsync(model); return(Ok(true)); } catch { return(Ok(false)); } }
public async Task <bool> EditUserProfilePictureAsync(PublicUserProfileModel model) { return(await _publicUserProfileService.ChangeProfilePictureAsync(model)); }
public async Task SeedUsers(int seedAmount) { await TestCleaner.CleanDatabase(); IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IListingRepository listingRepository = new ListingRepository(dataGateway, connectionString); ICollaborationRepository listingCollaborationRepository = new CollaborationRepository(dataGateway, connectionString); IRelationshipRepository listingRelationshipRepository = new RelationshipRepository(dataGateway, connectionString); ITeamModelRepository listingTeamModelRepository = new TeamModelRepository(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserAccountSettingsRepository userAccountSettingsRepository = new UserAccountSettingRepository(dataGateway, connectionString); IAssignmentPolicyRepository assignmentPolicyRepository = new AssignmentPolicyRepository(dataGateway, connectionString); IAssignmentPolicyPairingRepository assignmentPolicyPairingRepository = new AssignmentPolicyPairingRepository(dataGateway, connectionString); IScopeRepository scopeRepsitory = new ScopeRepository(dataGateway, connectionString); IClaimRepository claimRepository = new ClaimRepository(dataGateway, connectionString); IScopeClaimRepository scopeClaimRepository = new ScopeClaimRepository(dataGateway, connectionString); IUserScopeClaimRepository userScopeClaimRepository = new UserScopeClaimRepository(dataGateway, connectionString); IScopeService scopeService = new ScopeService(claimRepository, scopeRepsitory, scopeClaimRepository, userScopeClaimRepository); ICryptographyService cryptographyService = new CryptographyService(userAccountRepository); IAssignmentPolicyService assignmentPolicyService = new AssignmentPolicyService(assignmentPolicyRepository, assignmentPolicyPairingRepository, scopeRepsitory, scopeService); IClaimsService claimService = new ClaimsService(claimRepository, scopeRepsitory, scopeClaimRepository, userScopeClaimRepository); IListingCreationService listingCreationService = new ListingCreationService(listingRepository, listingCollaborationRepository, listingRelationshipRepository, listingTeamModelRepository); var accounts = await userAccountRepository.GetAllAccounts(); var accountSettings = await userAccountSettingsRepository.GetAllSettings(); IUserChannelsRepo userChannelsRepo = new UserChannelsRepo(dataGateway, connectionString); var userChannels = await userChannelsRepo.GetAllUserChannelsAsync(); foreach (var userChannel in userChannels) { await userChannelsRepo.DeleteUserChannelsByIdAsync(userChannel.Id); } await DataAccessTestHelper.ReseedAsync("UserChannels", 0, connectionString, dataGateway); IMessagesRepo messagesRepo = new MessagesRepo(dataGateway, connectionString); var messages = await messagesRepo.GetAllMessagesAsync(); foreach (var message in messages) { await messagesRepo.DeleteMessageByIdAsync(message.Id); } await DataAccessTestHelper.ReseedAsync("Messages", 0, connectionString, dataGateway); IChannelsRepo channelsRepo = new ChannelsRepo(dataGateway, connectionString); var channels = await channelsRepo.GetAllChannelsAsync(); foreach (var channel in channels) { await channelsRepo.DeleteChannelbyIdAsync(channel.Id); } IAccountVerificationRepo accountVerification = new AccountVerificationRepo(dataGateway, connectionString); var verfications = await accountVerification.GetAllAccountVerifications(); foreach (var verfication in verfications) { await accountVerification.DeleteAccountVerificationById(verfication.Id); } await DataAccessTestHelper.ReseedAsync("AccountVerification", 0, connectionString, dataGateway); IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString); var publicProfiles = await publicUserProfileRepo.GetAllPublicProfiles(); foreach (var profile in publicProfiles) { await publicUserProfileRepo.DeletePublicProfileById(profile.Id); } await DataAccessTestHelper.ReseedAsync("PublicUserProfile", 0, connectionString, dataGateway); if (accounts != null) { var numRows = accounts.ToList().Count; for (int i = 1; i <= numRows; ++i) { await userAccountSettingsRepository.DeleteUserAccountSettingsByUserId(i); } } await TestCleaner.CleanDatabase(); await DataAccessTestHelper.ReseedAsync("UserAccountSettings", 0, connectionString, dataGateway); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); var assignedScopes = new List <ScopeModel>(); var namedScopes = new List <string>() { "friends_list:read,", "friends_list:write,", "friends_list:delete,", "friends_list:block,", "friends_list:approve,", "user_profile:read,", "user_profile:report,", "user_profile:write,", "user_profile.friends_list.status:read,", "application:read,", "user_profile.visibility:read,", "user_profile.photo:upload,", "messaging:send,", "messaging:get,", "messaging.users:get,", "messaging.channels:addUser,", "messaging.channels:removeUser,", "channels.user:getall,", "channels:create,", "channels:getowner,", "channels:delete,", "message:delete,", "channel:setonline,", "channel:setoffline,", "account:delete,", "account:passwordchange,", "account.fontszie:change,", "account.email:change,", "account.fontSize:get,", "account.fontstyle:change,", "account.fontstyle:get,", "account.theme:change,", "account.theme:get,", "listings:read,", "listings:write," }; var claims = new List <ClaimModel>(); claims.Add(new ClaimModel() { Type = "channel_owner", Value = "false", IsDefault = true }); claims.Add(new ClaimModel() { Type = "Moderator", Value = "false", IsDefault = true }); var currentClaims = await claimService.GetAllClaims(); foreach (var claim in claims) { foreach (var currentClaim in currentClaims) { if (claim.Type == currentClaim.Type) { continue; } } await claimService.CreateClaim(claim); } var databaseClaims = await claimService.GetAllClaims(); foreach (var scope in namedScopes) { assignedScopes.Add(new ScopeModel() { Type = scope, Claims = databaseClaims, Description = null, IsDefault = true }); } assignedScopes.ForEach(async x => await scopeService.CreateScope(x)); var scopes = (await scopeService.GetAllScopes()).ToList(); var assignmentPolicies = await assignmentPolicyService.CreateAssignmentPolicy(new BusinessModels.UserAccessControl.AssignmentPolicyModel() { Default = true, Name = "DefaultAccessPolicy", AssignedScopes = scopes, Priority = 1, RequiredAccountType = "user" }); var adminPolicies = await assignmentPolicyService.CreateAssignmentPolicy(new BusinessModels.UserAccessControl.AssignmentPolicyModel() { Default = true, Name = "DefaultAdminPolicy", AssignedScopes = scopes, Priority = 1, RequiredAccountType = "admin" }); PublicUserProfileManager publicUserProfileManager = new PublicUserProfileManager(new PublicUserProfileService(publicUserProfileRepo, new ValidationService(userAccountService, userProfileService))); IAccountVerificationRepo accountVerificationRepo = new AccountVerificationRepo(new SQLServerGateway(), new ConnectionStringData()); IDictionary <string, string> _testConfigKeys = new Dictionary <string, string>(); _testConfigKeys.Add("Sender", "*****@*****.**"); _testConfigKeys.Add("TrackOpens", "true"); _testConfigKeys.Add("Subject", "Welcome!"); _testConfigKeys.Add("TextBody", "Welcome to InfiniMuse!"); _testConfigKeys.Add("MessageStream", "outbound"); _testConfigKeys.Add("Tag", "Welcome"); _testConfigKeys.Add("HtmlBody", "Thank you for registering! Please confirm your account with the link: <a href='{0}'>Confirm Your Account!</a><strong>Once confirmed you will have access to the features.</strong>"); IConfiguration configuration = new ConfigurationBuilder() .AddInMemoryCollection(_testConfigKeys) .Build(); EmailService emailService = new EmailService(new UserAccountRepository (new SQLServerGateway(), new ConnectionStringData()), new AccountVerificationRepo (new SQLServerGateway(), new ConnectionStringData()), new UserAccountService(new UserAccountRepository (new SQLServerGateway(), new ConnectionStringData())), configuration); for (int i = 1; i < seedAmount; ++i) { UserAccountModel userAccountModel = new UserAccountModel(); UserProfileModel userProfileModel = new UserProfileModel(); UserAccountSettingsModel userAccountSettingsModel = new UserAccountSettingsModel(); userAccountModel.Id = i; userAccountModel.Username = "******" + i; userAccountModel.Password = "" + i; userAccountModel.Salt = "" + i; userAccountModel.EmailAddress = "TestEmailAddress" + i; userAccountModel.AccountType = "user"; userAccountModel.AccountStatus = "TestAccountStatus" + i; userAccountModel.CreationDate = DateTimeOffset.UtcNow; userAccountModel.UpdationDate = DateTimeOffset.UtcNow; userProfileModel.Id = i; userProfileModel.FirstName = "TestFirstName" + i; userProfileModel.Surname = "TestSurname" + i; userProfileModel.DateOfBirth = DateTimeOffset.UtcNow; userProfileModel.UserAccountId = userAccountModel.Id; userAccountSettingsModel.Id = i; userAccountSettingsModel.UserId = userAccountModel.Id; userAccountSettingsModel.FontSize = 12; userAccountSettingsModel.FontStyle = "Default"; userAccountSettingsModel.ThemeColor = "Light"; await userAccountRepository.CreateAccount(userAccountModel); await cryptographyService.newPasswordEncryptAsync("T" + i, i); await userProfileRepository.CreateUserProfile(userProfileModel); await userAccountSettingsRepository.CreateUserAccountSettings(userAccountSettingsModel); PublicUserProfileModel publicUserProfileModel = new PublicUserProfileModel(); publicUserProfileModel.UserId = userAccountModel.Id; publicUserProfileModel.Description = "My name is " + userAccountModel.Username; publicUserProfileModel.Visibility = "Public"; publicUserProfileModel.Age = userAccountModel.Id + 20; publicUserProfileModel.Hobbies = "These are my hobbies"; publicUserProfileModel.Intrests = "These are my intrests"; publicUserProfileModel.Height = "This is how tall I am"; await publicUserProfileManager.CeatePublicUserProfileAsync(publicUserProfileModel); await emailService.CreateVerificationToken(publicUserProfileModel.UserId); } IMessagingService messagingService = new MessagingService(messagesRepo, channelsRepo, userChannelsRepo, userAccountRepository); ChannelModel model = new ChannelModel(); model.OwnerId = 1; model.Name = "Jakes Group"; await messagingService.CreateChannelAsync(model); for (int i = 2; i < 19; i++) { await messagingService.AddUserToChannelAsync(i, 1); } IFriendListRepo friendListRepo = new FriendListRepo(dataGateway, connectionString); IFriendRequestListRepo friendRequestListRepo = new FriendRequestListRepo(dataGateway, connectionString); IFriendBlockListRepo friendBlockListRepo = new FriendBlockListRepo(dataGateway, connectionString); IEnumerable <FriendsListJunctionModel> friends = await friendListRepo.GetAllFriends(); foreach (var friend in friends) { await friendListRepo.DeleteFriendListbyId(friend.Id); } await DataAccessTestHelper.ReseedAsync("FriendsList", 0, connectionString, dataGateway); IEnumerable <FriendsListJunctionModel> requets = await friendRequestListRepo.GetAllFriendRequests(); foreach (var request in requets) { await friendRequestListRepo.DeleteFriendRequestListbyId(request.Id); } await DataAccessTestHelper.ReseedAsync("FriendRequestList", 0, connectionString, dataGateway); IEnumerable <FriendsListJunctionModel> blocks = await friendBlockListRepo.GetAllFriendBlocks(); foreach (var block in blocks) { await friendBlockListRepo.DeleteFriendBlockbyId(block.Id); } await DataAccessTestHelper.ReseedAsync("FriendBlockList", 0, connectionString, dataGateway); for (int i = 0; i < 20; i++) { BusinessCollaborationModel newBusinessCollaborationModel = new BusinessCollaborationModel(); BusinessListingModel newBusinessListingModel = new BusinessListingModel(); newBusinessCollaborationModel.Title = "TestTitle" + i; newBusinessCollaborationModel.Details = "TestDetails" + i; newBusinessCollaborationModel.City = "TestCity" + i; newBusinessCollaborationModel.State = "TestState" + i; newBusinessCollaborationModel.NumberOfParticipants = i; newBusinessCollaborationModel.InPersonOrRemote = "InpersonOrRemoteTest" + i; newBusinessCollaborationModel.UserAccountId = i; newBusinessCollaborationModel.CollaborationType = "TestcollaborationType" + i; newBusinessCollaborationModel.InvolvementType = "InvolvementType" + i; newBusinessCollaborationModel.Experience = "Testexperience" + i; newBusinessCollaborationModel.CollaborationType = "TestCollaborationType" + i; newBusinessCollaborationModel.InvolvementType = "TestInvolvementType" + i; newBusinessCollaborationModel.Experience = "TestExperience" + i; await listingCreationService.CreateListing(newBusinessCollaborationModel); } for (int i = 21; i < 40; i++) { BusinessRelationshipModel newBusinessRelationshipModel = new BusinessRelationshipModel(); BusinessListingModel newBusinessListingModel1 = new BusinessListingModel(); newBusinessRelationshipModel.Title = "TestTitle" + i; newBusinessRelationshipModel.Details = "TestDetails" + i; newBusinessRelationshipModel.City = "TestCity" + i; newBusinessRelationshipModel.State = "TestState" + i; newBusinessRelationshipModel.NumberOfParticipants = i; newBusinessRelationshipModel.InPersonOrRemote = "InpersonOrRemoteTest" + i; newBusinessRelationshipModel.UserAccountId = i; newBusinessRelationshipModel.RelationshipType = "TestcollaborationType" + i; newBusinessRelationshipModel.Age = 21; newBusinessRelationshipModel.Interests = "TestInterests" + i; newBusinessRelationshipModel.GenderPreference = "TestGenderPreference" + i; await listingCreationService.CreateListing(newBusinessRelationshipModel); } for (int i = 41; i < 60; i++) { BusinessTeamModel newBusinessTeamModel = new BusinessTeamModel(); BusinessListingModel newBusinessListingModel1 = new BusinessListingModel(); newBusinessTeamModel.Title = "TestTitle" + i; newBusinessTeamModel.Details = "TestDetails" + i; newBusinessTeamModel.City = "TestCity" + i; newBusinessTeamModel.State = "TestState" + i; newBusinessTeamModel.NumberOfParticipants = i; newBusinessTeamModel.InPersonOrRemote = "InpersonOrRemoteTest" + i; newBusinessTeamModel.UserAccountId = i + 1; newBusinessTeamModel.TeamType = "TestTeamType" + i; newBusinessTeamModel.GameType = "TestGameType" + i; newBusinessTeamModel.Platform = "TestPlatform" + i; newBusinessTeamModel.Experience = "TestExperience" + i; await listingCreationService.CreateListing(newBusinessTeamModel); } IUserReportsRepo userReportsRepo = new UserReportsRepo(dataGateway, connectionString); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService); IUserInteractionService userInteractionService = new UserInteractionService(friendBlockListRepo, friendListRepo, friendRequestListRepo, userReportsRepo, validationService); IFriendListManager friendListManager = new FriendListManager(userAccountRepository, publicUserProfileService, userInteractionService); for (int i = 10; i < 15; i++) { await friendListManager.RequestFriendAsync(1, i); } await friendListManager.RequestFriendAsync(18, 1); for (int i = 2; i < 10; i++) { await friendListManager.RequestFriendAsync(1, i); await friendListManager.ConfirmFriendAsync(1, i); } for (int i = 3; i < 10; i++) { await friendListManager.RequestFriendAsync(2, i); await friendListManager.ConfirmFriendAsync(2, i); } await friendListManager.BlockFriendAsync(19, 1); MessageModel messageModel = new MessageModel(); messageModel.ChannelId = 1; messageModel.UserId = 1; messageModel.Message = "Hi Tim"; await messagingService.SendMessageAsync(messageModel); messageModel = new MessageModel(); messageModel.ChannelId = 1; messageModel.UserId = 2; messageModel.Message = "Whats up Jake"; await messagingService.SendMessageAsync(messageModel); model = new ChannelModel(); model.OwnerId = 3; model.Name = "Richards Group"; await messagingService.CreateChannelAsync(model); await messagingService.AddUserToChannelAsync(1, 2); await messagingService.AddUserToChannelAsync(2, 2); messageModel = new MessageModel(); messageModel.ChannelId = 2; messageModel.UserId = 3; messageModel.Message = "Hi Jake and Tim"; await messagingService.SendMessageAsync(messageModel); messageModel = new MessageModel(); messageModel.ChannelId = 2; messageModel.UserId = 1; messageModel.Message = "Whats up Richard how are you doing"; await messagingService.SendMessageAsync(messageModel); messageModel = new MessageModel(); messageModel.ChannelId = 2; messageModel.UserId = 3; messageModel.Message = "Im Chilling"; await messagingService.SendMessageAsync(messageModel); messageModel = new MessageModel(); messageModel.ChannelId = 2; messageModel.UserId = 3; messageModel.Message = "Just doing some homework"; await messagingService.SendMessageAsync(messageModel); messageModel = new MessageModel(); messageModel.ChannelId = 2; messageModel.UserId = 1; messageModel.Message = "Oh nice, I started spring break this week and I finished all of my homework a few days ago so im just relaxing playing some warzone"; await messagingService.SendMessageAsync(messageModel); messageModel = new MessageModel(); messageModel.ChannelId = 2; messageModel.UserId = 3; messageModel.Message = "Oh sweet"; await messagingService.SendMessageAsync(messageModel); messageModel = new MessageModel(); messageModel.ChannelId = 2; messageModel.UserId = 2; messageModel.Message = "Whats up guys its me Tim"; await messagingService.SendMessageAsync(messageModel); messageModel = new MessageModel(); messageModel.ChannelId = 2; messageModel.UserId = 3; messageModel.Message = "Hey Tim"; await messagingService.SendMessageAsync(messageModel); messageModel = new MessageModel(); messageModel.ChannelId = 2; messageModel.UserId = 1; messageModel.Message = "Whats up tim"; await messagingService.SendMessageAsync(messageModel); messageModel = new MessageModel(); messageModel.ChannelId = 2; messageModel.UserId = 2; messageModel.Message = "Nothing much guys"; await messagingService.SendMessageAsync(messageModel); messageModel = new MessageModel(); messageModel.ChannelId = 2; messageModel.UserId = 1; messageModel.Message = "You guys wanna hop on warzone with me"; await messagingService.SendMessageAsync(messageModel); }
public async Task Init() { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IUserAccountSettingsRepository userAccountSettingsRepository = new UserAccountSettingRepository(dataGateway, connectionString); IUserChannelsRepo userChannelsRepo = new UserChannelsRepo(dataGateway, connectionString); var userChannels = await userChannelsRepo.GetAllUserChannelsAsync(); foreach (var userChannel in userChannels) { await userChannelsRepo.DeleteUserChannelsByIdAsync(userChannel.Id); } await DataAccessTestHelper.ReseedAsync("UserChannels", 0, connectionString, dataGateway); IMessagesRepo messagesRepo = new MessagesRepo(dataGateway, connectionString); var messages = await messagesRepo.GetAllMessagesAsync(); foreach (var message in messages) { await messagesRepo.DeleteMessageByIdAsync(message.Id); } await DataAccessTestHelper.ReseedAsync("Messages", 0, connectionString, dataGateway); IChannelsRepo channelsRepo = new ChannelsRepo(dataGateway, connectionString); var channels = await channelsRepo.GetAllChannelsAsync(); foreach (var channel in channels) { await channelsRepo.DeleteChannelbyIdAsync(channel.Id); } await DataAccessTestHelper.ReseedAsync("Channels", 0, connectionString, dataGateway); IUserReportsRepo userReportsRepo = new UserReportsRepo(dataGateway, connectionString); IEnumerable <UserReportsModel> reports = await userReportsRepo.GetAllReports(); foreach (var report in reports) { await userReportsRepo.DeleteReportById(report.Id); } await DataAccessTestHelper.ReseedAsync("UserReports", 0, connectionString, dataGateway); IFriendListRepo friendListRepo = new FriendListRepo(dataGateway, connectionString); IEnumerable <FriendsListJunctionModel> friends = await friendListRepo.GetAllFriends(); foreach (var friend in friends) { await friendListRepo.DeleteFriendListbyId(friend.Id); } await DataAccessTestHelper.ReseedAsync("FriendsList", 0, connectionString, dataGateway); IFriendRequestListRepo friendRequestListRepo = new FriendRequestListRepo(dataGateway, connectionString); IEnumerable <FriendsListJunctionModel> requets = await friendListRepo.GetAllFriends(); foreach (var request in requets) { await friendListRepo.DeleteFriendListbyId(request.Id); } await DataAccessTestHelper.ReseedAsync("FriendRequestList", 0, connectionString, dataGateway); var settings = await userAccountSettingsRepository.GetAllSettings(); foreach (var setting in settings) { await userAccountSettingsRepository.DeleteUserAccountSettingsByUserId(setting.UserId); } await DataAccessTestHelper.ReseedAsync("UserAccountSettings", 0, connectionString, dataGateway); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); var accounts = await userAccountRepository.GetAllAccounts(); foreach (var account in accounts) { await userAccountRepository.DeleteAccountById(account.Id); } await DataAccessTestHelper.ReseedAsync("UserAccount", 0, connectionString, dataGateway); IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString); var profiles = await publicUserProfileRepo.GetAllPublicProfiles(); foreach (var profile in profiles) { await publicUserProfileRepo.DeletePublicProfileById(profile.Id); } await DataAccessTestHelper.ReseedAsync("PublicUserProfile", 0, connectionString, dataGateway); int i = 1; UserAccountModel userAccountModel = new UserAccountModel(); userAccountModel.Id = i; userAccountModel.Username = "******" + i; userAccountModel.Password = "" + i; userAccountModel.Salt = "" + i; userAccountModel.EmailAddress = "TestEmailAddress" + i; userAccountModel.AccountType = "TestAccountType" + i; userAccountModel.AccountStatus = "TestAccountStatus" + i; userAccountModel.CreationDate = DateTimeOffset.UtcNow; userAccountModel.UpdationDate = DateTimeOffset.UtcNow; await userAccountRepository.CreateAccount(userAccountModel); UserAccountRepository userAccountRepo = new UserAccountRepository(new SQLServerGateway(), new ConnectionStringData()); ICryptographyService cryptographyService = new CryptographyService(userAccountRepo); await cryptographyService.newPasswordEncryptAsync("Password", 1); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService); PublicUserProfileManager publicUserProfileManager = new PublicUserProfileManager(publicUserProfileService); PublicUserProfileModel publicUserProfileModel = new PublicUserProfileModel(); publicUserProfileModel.UserId = i; await publicUserProfileManager.CeatePublicUserProfileAsync(publicUserProfileModel); UserAccountSettingsModel userAccountSettingsModel = new UserAccountSettingsModel(); userAccountSettingsModel.Id = 0; userAccountSettingsModel.UserId = 1; userAccountSettingsModel.FontSize = 12; userAccountSettingsModel.FontStyle = "Time New Roman"; userAccountSettingsModel.ThemeColor = "White"; IAuthenticationService authenticationService = new AuthenticationService(userAccountRepository); IAccountSettingsService userAccountSettingsManager = new AccountSettingsService(userAccountRepository, userAccountSettingsRepository, cryptographyService, authenticationService); await userAccountSettingsManager.CreateUserAccountSettingsAsync(userAccountSettingsModel); i = 2; userAccountModel.Id = i; userAccountModel.Username = "******" + i; userAccountModel.Password = "" + i; userAccountModel.Salt = "" + i; userAccountModel.EmailAddress = "TestEmailAddress" + i; userAccountModel.AccountType = "TestAccountType" + i; userAccountModel.AccountStatus = "TestAccountStatus" + i; userAccountModel.CreationDate = DateTimeOffset.UtcNow; userAccountModel.UpdationDate = DateTimeOffset.UtcNow; await userAccountRepository.CreateAccount(userAccountModel); publicUserProfileModel = new PublicUserProfileModel(); publicUserProfileModel.UserId = i; await publicUserProfileManager.CeatePublicUserProfileAsync(publicUserProfileModel); i = 3; userAccountModel.Id = i; userAccountModel.Username = "******" + i; userAccountModel.Password = "" + i; userAccountModel.Salt = "" + i; userAccountModel.EmailAddress = "TestEmailAddress" + i; userAccountModel.AccountType = "TestAccountType" + i; userAccountModel.AccountStatus = "TestAccountStatus" + i; userAccountModel.CreationDate = DateTimeOffset.UtcNow; userAccountModel.UpdationDate = DateTimeOffset.UtcNow; await userAccountRepository.CreateAccount(userAccountModel); await cryptographyService.newPasswordEncryptAsync("Password", 1); publicUserProfileModel = new PublicUserProfileModel(); publicUserProfileModel.UserId = i; await publicUserProfileManager.CeatePublicUserProfileAsync(publicUserProfileModel); userAccountSettingsModel.Id = 1; userAccountSettingsModel.UserId = 2; userAccountSettingsModel.FontSize = 12; userAccountSettingsModel.FontStyle = "Time New Roman"; userAccountSettingsModel.ThemeColor = "White"; await userAccountSettingsManager.CreateUserAccountSettingsAsync(userAccountSettingsModel); }
public async Task <bool> EditPublicUserProfileAsync(PublicUserProfileModel model) { bool finalResult = true; if (model.Age < 1000) { bool result = await _publicUserProfileService.UpdateProfileAgeAsync(model); if (result == false) { finalResult = false; } } if (model.Description.Length <= 1000) { bool result = await _publicUserProfileService.UpdateProfileDescriptionAsync(model); if (result == false) { finalResult = false; } } if (model.Ethnicity.Length <= 100) { bool result = await _publicUserProfileService.UpdateProfileEthnicityAsync(model); if (result == false) { finalResult = false; } } if (model.Gender == "Male" || model.Gender == "Female") { bool result = await _publicUserProfileService.UpdateProfileGenderAsync(model); if (result == false) { finalResult = false; } } if (model.Goals.Length <= 1000) { bool result = await _publicUserProfileService.UpdateProfileGoalsAsync(model); if (result == false) { finalResult = false; } } if (model.Height.Length <= 1000) { bool result = await _publicUserProfileService.UpdateProfileHeightAsync(model); if (result == false) { finalResult = false; } } if (model.Hobbies.Length <= 1000) { bool result = await _publicUserProfileService.UpdateProfileHobbiesAsync(model); if (result == false) { finalResult = false; } } if (model.Intrests.Length <= 1000) { bool result = await _publicUserProfileService.UpdateProfileIntrestsAsync(model); if (result == false) { finalResult = false; } } if (model.Jobs.Length <= 1000) { bool result = await _publicUserProfileService.UpdateProfileJobsAsync(model); if (result == false) { finalResult = false; } } if (model.SexualOrientation.Length <= 100) { bool result = await _publicUserProfileService.UpdateProfileSexualOrientationAsync(model); if (result == false) { finalResult = false; } } if (model.Visibility == "Public" || model.Visibility == "Private" || model.Visibility == "Friends") { bool result = await _publicUserProfileService.UpdateProfileVisibilityAsync(model); if (result == false) { finalResult = false; } } return(finalResult); }