public static int GetVocabEntryRank(UserProfile user, VocabEntryHandle handle) { var historyItem = user.History.VocabHistory.Where(vhi => vhi.VocabEntry.Equals(handle)).FirstOrDefault(); if (historyItem == null) { return 0; } return (int)historyItem.Rank; }
public static void UpdateVocabulary(UserProfile userProfile, VocabEntryHandle entry, VocabRankTypes rankType, AnswerScore score = AnswerScore.Unknown) { VocabularyHistoryItem vhi = userProfile.History.VocabHistory.Find(h => h.VocabEntry.Equals(entry)); if (vhi == null) { vhi = new VocabularyHistoryItem() { Rank = rankType, VocabEntry = entry }; userProfile.History.VocabHistory.Insert(0, vhi); } HistoryItemOperations.UpdateHistoryItemWithSuccessFailureAndTimestamp(vhi, score); }