public IActionResult Search(string searchText) { if (string.IsNullOrEmpty(searchText)) { return(View()); } var buildings = _buildingService.SearchBuilding(searchText); var locks = new List <LockViewModel>(); if (buildings.Count() == 0) { locks = _lockService.SearchLocksByText(searchText); } var groups = _groupService.SearchGroup(searchText); var media = new List <MediaViewModel>(); if (groups.Count() == 0) { media = _mediaService.SearchMediaByText(searchText); } var result = new ModelViewData { BuildingList = buildings, GroupList = groups, LockList = locks, MediaList = media, SearchText = searchText }; return(View("Views/Home/Index.cshtml", result)); }