public AccountResponse IdentifyAccount(AccountRequest accountRequest) { Guid? account_id=null; using (JourneyDbDataContext journeyDbContext = new JourneyDbDataContext()) { journeyDbContext.GetAccount(accountRequest.GigyaUID, accountRequest.EmailId, accountRequest.Password, ref account_id); } AccountResponse ar = new AccountResponse(); if(account_id.HasValue) ar.AccountId = account_id.Value; ar.Configuration = new AccountConfiguration(); return ar; }
public AccountResponse StartANewAccount(AccountRequest accountRequest) { string uid = accountRequest.GigyaUID; string methodName = "socialize.getUserInfo"; string apiKey = ConfigurationManager.AppSettings["apikey"]; string secretKey = ConfigurationManager.AppSettings["secretkey"]; GSRequest request = new GSRequest(apiKey, secretKey, methodName, false); // Step 2 - Adding parameters request.setParam("uid", uid); // set the "uid" parameter to user's ID // Step 3 - Sending the request GSResponse response = request.send(); string nickname = response.getString("nickname", ""); string City = response.getString("city", ""); string CountryName = response.getString("country", ""); string FirstName = response.getString("firstName", ""); string LastName = response.getString("lastName", ""); string GigyaLoginProvider = response.getString("loginProvider", ""); string NickName = response.getString("nickname", ""); Guid? account_id=null; using (JourneyDbDataContext journeyDbContext = new JourneyDbDataContext()) { journeyDbContext.AddAccount(accountRequest.GigyaUID, accountRequest.EmailId, accountRequest.Password, accountRequest.DeviceId, accountRequest.CountryCode, GigyaLoginProvider, NickName, FirstName, LastName, City, CountryName, ref account_id); } AccountResponse ar = new AccountResponse(); if (account_id.HasValue) ar.AccountId = account_id.Value; ar.Configuration = new AccountConfiguration(); return ar; }