Exemple #1
0
        private SearchResult UpdateSearchHistory(string searchId, DateTime searchDate, double takenTime, int resultsCount)
        {
            SearchHistoryEntity entity = new SearchHistoryEntity(searchId, searchDate, takenTime, resultsCount);
            TableResult         result = _searchHistoryTable.Execute(TableOperation.InsertOrReplace(entity));

            return(new SearchResult(searchId, searchDate, takenTime, resultsCount));
        }
Exemple #2
0
        private SearchResult GetSearchHistory(string searchId)
        {
            TableResult         result = _searchHistoryTable.ExecuteRetriveOperation(TableOperation.Retrieve <SearchHistoryEntity>(searchId, searchId));
            SearchHistoryEntity entity = result.Result as SearchHistoryEntity;

            if (entity != null)
            {
                return(new SearchResult(entity.ResultId, entity.LastSearchDateUTC, entity.TakenTime, entity.ResultsCount));
            }
            else
            {
                return(null);
            }
        }
Exemple #3
0
 /// <summary>
 /// Update a user's search history by adding, removing, or modifying <paramref name="item"/>.
 /// </summary>
 /// <param name="entity">The search history for the user.</param>
 /// <param name="item">The item to modify.</param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> allowing the operation to be canceled.</param>
 /// <returns>A task signalling completion.</returns>
 public async Task UpdateSearchHistoryAsync(SearchHistoryEntity entity, SearchHistoryItemPart item, CancellationToken cancellationToken = default)
 {
     await Client.PostAsync(entity, "Update", item, cancellationToken : cancellationToken);
 }