public ActionResult QuickSearchPlace(AjaxSearchParams searchParams) { List<int> idsToExclude = new List<int>(); if (searchParams.Excludes != null) idsToExclude.AddRange(searchParams.Excludes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(artistIDToExclude => int.Parse(artistIDToExclude))); var searchResults = _placeManager.SearchPlace(searchParams.Term, idsToExclude).Result.Take(10).Select(p => new { label = p.PlaceName, value = p.PlaceId }); return Json(searchResults, JsonRequestBehavior.AllowGet); }
public ActionResult JsonQuickSearchPictures(AjaxSearchParams searchParams) { List<int> idsToExclude = new List<int>(); if (searchParams.Excludes != null) idsToExclude.AddRange(searchParams.Excludes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(artistIDToExclude => int.Parse(artistIDToExclude))); var modelMapper = new PhotoViewModelMapper(); var searchResults = _photoManager.SearchPictures(searchParams.Term, idsToExclude).Result.Take(10).Select(x => modelMapper.Map(x, Url)); return Json(searchResults, JsonRequestBehavior.AllowGet); }