// // GET: /Dog/Details/5 public ActionResult Details(int id, SearchViewModel searchViewModel) { // get dog var dog = _searchRepository.GetDogDetails(id); return View(dog); }
private void InjectionInitialize( ICharacterService characterService, IComicService comicService, ICreatorService creatorService, ISeriesService seriesService, IEventService eventService, ILoadingManager loadingManager, IScreenManager screenManager, IEventManager eventManager, IResultProcessor resultProcessor, IPlanetSystemSpawner planetSystemSpawner, SearchViewModel searchViewModel) { this.characterService = characterService; this.comicService = comicService; this.creatorService = creatorService; this.seriesService = seriesService; this.eventService = eventService; this.loadingManager = loadingManager; this.screenManager = screenManager; this.eventManager = eventManager; this.resultProcessor = resultProcessor; this.planetSystemSpawner = planetSystemSpawner; this.searchViewModel = searchViewModel; this.eventManager.GetEvent<LoadingEvent>().AddListener(this.OnLoading); }
public ActionResult Index(int? p, string term) { if (!string.IsNullOrEmpty(term)) { using (UnitOfWorkManager.NewUnitOfWork()) { if (!string.IsNullOrEmpty(term)) { term = term.Trim(); } // Get the global settings var settings = SettingsService.GetSettings(); // Get allowed categories var allowedCategories = _categoryService.GetAllowedCategories(UsersRole); // Set the page index var pageIndex = p ?? 1; // Get all the topics based on the search value var posts = _postService.SearchPosts(pageIndex, SiteConstants.Instance.SearchListSize, int.MaxValue, term, allowedCategories); // Get all the permissions for these topics var topicPermissions = ViewModelMapping.GetPermissionsForTopics(posts.Select(x => x.Topic), RoleService, UsersRole); // Get the post Ids var postIds = posts.Select(x => x.Id).ToList(); // Get all votes for these posts var votes = _voteService.GetVotesByPosts(postIds); // Get all favourites for these posts var favs = _favouriteService.GetAllPostFavourites(postIds); // Create the post view models var viewModels = ViewModelMapping.CreatePostViewModels(posts.ToList(), votes, topicPermissions, LoggedOnReadOnlyUser, settings, favs); // create the view model var viewModel = new SearchViewModel { Posts = viewModels, PageIndex = pageIndex, TotalCount = posts.TotalCount, TotalPages = posts.TotalPages, Term = term }; return View(viewModel); } } return RedirectToAction("Index", "Home"); }