public static SearchVM GetVM(CategorySearchResult searchResult) { var vm = new SearchVM(searchResult ?? throw new ArgumentNullException(nameof(searchResult))); using (var db = new HistoryDb()) { db.AddHistory(new HistoryRecord { Type = HistoryRecordType.Search, Uri = vm.SearchResult.SearchUri, Title = vm.Keyword, }); } Cache[vm.SearchQuery] = vm; return(vm); }
public static FavoritesVM GetVM(FavoritesSearchResult searchResult) { var vm = new FavoritesVM(searchResult ?? throw new ArgumentNullException(nameof(searchResult))); var query = vm.SearchQuery; using (var db = new HistoryDb()) { db.AddHistory(new HistoryRecord { Type = HistoryRecordType.Favorite, Uri = vm.SearchResult.SearchUri, Title = vm.Keyword, }); } Cache[query] = vm; return(vm); }