Ejemplo n.º 1
0
        public void RefreshBooks()
        {
            if (string.IsNullOrEmpty(this.filter))
            {
                this.Books = new ObservableCollection <BookItemViewModel>(this.myBooks.Select(b => new BookItemViewModel
                {
                    Image    = b.Image,
                    Isbn13   = b.Isbn13,
                    Price    = b.Price,
                    Subtitle = b.Subtitle,
                    Title    = b.Title,
                    Url      = b.Url
                })
                                                                          .OrderBy(b => b.Title)
                                                                          .ToList());
            }
            else
            {
                this.Books = new ObservableCollection <BookItemViewModel>(this.myBooks.Select(b => new BookItemViewModel
                {
                    Image    = b.Image,
                    Isbn13   = b.Isbn13,
                    Price    = b.Price,
                    Subtitle = b.Subtitle,
                    Title    = b.Title,
                    Url      = b.Url
                })
                                                                          .Where(b => b.Title.ToLower().Contains(this.filter.ToLower()) || b.Subtitle.ToLower().Contains(this.filter.ToLower()))
                                                                          .OrderBy(b => b.Title)
                                                                          .ToList());

                var searches = new LastSearchHelper();
                searches.AddSearch(this.filter);
            }
        }
Ejemplo n.º 2
0
 public LastSearchViewModel()
 {
     this.LastSearchHelper = new LastSearchHelper();
     this.LastSearches     = new ObservableCollection <LastSearch>(this.LastSearchHelper.GetLastSearches());
 }