public void SaveSettings(UserEntry userEntry) { UserEntry dbEntry = userContext.UserSettingsTable.Find(userEntry.Id); if (dbEntry != null) { userContext.Entry(dbEntry).CurrentValues.SetValues(userEntry); } userContext.SaveChanges(); }
private FitbitUser CreateFitbitUser(UserEntry userEntry) { AFElement userElement = _afAccess.GetElementFromName(userEntry.UserName); if (userElement == null) return null; return _fitbitUserFactory.CreateFitbitUser(ConfigurationManager.AppSettings["fitbitConsumerKey"], ConfigurationManager.AppSettings["fitbitConsumerSecret"], userEntry.FitbitAuthToken, userEntry.FitbitAuthTokenSecret, userElement, true); }
private void TryAddFitbitUserToCache(UserEntry userEntry) { string userName = userEntry.UserName; FitbitUser fitbitUser = null; _fitbitUserCache.TryGetValue(userName, out fitbitUser); if (fitbitUser == null) { fitbitUser = CreateFitbitUser(userEntry); if (fitbitUser == null) { PIFitnessLog.Write(TraceEventType.Information, 0, string.Format("Unable to create FitbitUser for {0}", userName)); } _fitbitUserCache[userName] = fitbitUser; PIFitnessLog.Write(TraceEventType.Information, 0, string.Format("Added {0} to FitbitClient cache", userName)); } }