예제 #1
0
        /// <summary>
        /// Adds the search contained in the CurrentSearchviewModel to the collection of Searches.
        /// </summary>
        /// <param name="newSearch">The CurrentSearchViewModel</param>
        public static void AddSearch(CurrentSearchViewModel newSearch)
        {
            //  Map the SearchViewModel to the SearchCriteria.
            var mapper         = new MapSearchViewModelToSearchCriteria <CurrentSearchViewModel>(_libraryDataSource._ioc.Resolve <SearchCriteriaFactory>());
            var searchCriteria = mapper.Map(newSearch);

            //  Save in the data model
            var id = _libraryDataSource._searchRepository.AddSearch(searchCriteria);

            //  Add to the UI.
            _libraryDataSource.AllSearches.Add(MapSearchCriteriaToSearchViewModel.Map(searchCriteria));
        }
        /// <summary>
        /// Adds the search contained in the CurrentSearchviewModel to the collection of Searches.
        /// </summary>
        /// <param name="newSearch">The CurrentSearchViewModel</param>
        public static void AddSearch(CurrentSearchViewModel newSearch)
        {
            //  Map the SearchViewModel to the SearchCriteria.
            var mapper = new MapSearchViewModelToSearchCriteria<CurrentSearchViewModel>(_libraryDataSource._ioc.Resolve<SearchCriteriaFactory>());
            var searchCriteria = mapper.Map(newSearch);

            //  Save in the data model
            var id = _libraryDataSource._searchRepository.AddSearch(searchCriteria);

            //  Add to the UI.
            _libraryDataSource.AllSearches.Add(MapSearchCriteriaToSearchViewModel.Map(searchCriteria));
        }