public async Task<Profile> Register(Device device, Profile profile) //100% { var postParameters = new Dictionary<string, string> { {"username", profile.username}, {"password", profile.password}, {"primaryEmail", profile.primaryEmail}, {"referralId", profile.referralId}, {"genderId", profile.genderId}, {"givenName", profile.givenName}, {"surName", profile.surName}, {"birthCountryId", profile.birthCountryId}, {"owningMonitorProfileId", profile.owningMonitorProfileId}, {"owningPartnerProfileId", profile.owningPartnerProfileId}, {"dialCode", profile.dialCode}, {"cellPhone", device.Number}, {"clientCountryId", profile.clientCountryId}, {"lastSighting", profile.lastSighting}, {"nickName", profile.nickName}, {"otherInformation", profile.otherInformation}, {"otherName", profile.otherName}, {"tribe", profile.tribe}, {"alternateEmail", profile.alternateEmail}, {"homeTown", profile.homeTown}, {"preferredLanguageId", profile.preferredLanguageId}, {"userProfileStateId", profile.userProfileStateId}, {"actingUserProfileId", profile.actingUserProfileId}, {"assistingUserProfileId", profile.assistingUserProfileId}, {"sessionId", profile.sessionId}, }; var y = await Api("profile/", postParameters: postParameters); var x = JsonConvert.DeserializeAnonymousType(y, new {profile = new {id = 0}}); return await GetProfile(x.profile.id.ToString()); //EG "\n{\"profile\":{\"id\":324865}}" }
public async Task<ActionResult> Index() { //Test Data var testProfile = new Profile { username = "", givenName = "kaelanc", surName = "fouwelsc", password = "******", otherInformation = "I like trains", lastSighting = "Test" }; var testDevice = new Device { Number = "+447842073150" }; //Test Data var testUsername = await RefugeesUnitedService.GenerateUsername(testProfile.givenName, testProfile.surName); testProfile.username = testUsername; //Get API to generate a Username var testUserExists = await RefugeesUnitedService.UserExists(testProfile.username); //Check if user exists //var testRegister = await RefugeesUnitedService.Register(testDevice, testProfile); // todo <-- Problematic //Attempt to register said user var testLogin = await RefugeesUnitedService.Login(testDevice, "kaelanc.fouwelsc", "1234"); //Atempt to login said user var testSearch = await RefugeesUnitedService.Search(testProfile); //Search for said user var testLogout = await RefugeesUnitedService.Logout("kaelanc.fouwelsc"); //Attempt to logout said user //Break here return Content(""); }
public async Task<Profile> Login(Device device, string username, string password) //99*% { //todo sort out returns var parameters = new[] { new { Key = "password", Value = password} }; var y = await Api("profile/login/" + username, parameters.ToDictionary(e => e.Key, e => e.Value)); var x = JsonConvert.DeserializeObject<LoginResponse>(y); return null; //Don't know what data returns when logged is SUCCESSFULL - Would need ProfileID to get the profile. //EG "\n{\"authenticated\":false,\"verificationRequired\":false,\"forcePasswordReset\":false}" }
public void Blacklist(Device device, string reason) { DeviceRepository.Change(device, (ref Device d) => d.BlacklistReason = reason); }
public void DeviceAttach(User user, Device device) { UserRepository.Change(user, (ref User u) => u.Device = device); }
public IEnumerable<User> UsersForDevice(Device device) { return UserRepository.Where(u => u.Device == device); }
public async Task<Profile> Register(Profile user, Device device) { return await RefugeesUnitedService.Register(device, user); }
public async Task<Profile> Authenticate(User user, Device device, string password) { return await RefugeesUnitedService.Login(device, user.RefUnitedUsername, password); }