/// <summary> /// Updates the achievements. /// </summary> /// <param name="steamUserId">The steam user id.</param> /// <param name="language">The language.</param> /// <returns> /// true if successful, else false. /// </returns> public int UpdateAchievements(string steamUserId, string language = null) { if (steamUserId == null) { throw new ArgumentNullException("steamUserId"); } if (language == null) { language = CultureHelper.GetLanguage(); } ICollection <UserAchievement> achievements = _communityService.GetClosedAchievements(steamUserId, language); Data.User user = _achievementManager.GetUser(steamUserId); if (user == null) { throw new ArgumentException("User does not exist.", "steamUserId"); } int updated = _achievementManager.UpdateAchievements(achievements.ToDataAchievements(user.FacebookUserId)); return(updated); }
/// <summary> /// Updates the achievements. /// </summary> /// <param name="facebookUserId">The facebook user id.</param> /// <param name="language">The language.</param> /// <returns> /// true if successful, else false. /// </returns> public int UpdateAchievements(long facebookUserId, string language = null) { if (language == null) { language = CultureHelper.GetLanguage(); } string steamUserId = GetSteamUserId(facebookUserId); var userAchievements = _communityService.GetClosedAchievements(steamUserId, language); foreach (var achievement in userAchievements) { achievement.FacebookUserId = facebookUserId; } var dataUserAchievements = Mapper.Map <ICollection <Data.UserAchievement> >(userAchievements); int updated = _achievementManager.UpdateAchievements(dataUserAchievements); return(updated); }