Here's my code:
[HttpGet]
public IList<Video_List_ViewModel> Obtain(string key)
{
Video_List_ViewModel item = new Video_List_ViewModel();
foreach (var i in SearchEngineManager.Current.Search<Video_List>(key))
{
Common.PanguDll.GetItemType(key,item);
}
return AutoMapper.Mapper.Map<IList<Video_List>, IList<Video_List_ViewModel>>(SearchEngineManager.Current.Search<Video_List>(key));
}
So in this part of my code, I want to search the result in my video list by using key(keyword),and here is GetItemType method:
public static SearchType GetItemType(string keyword, Video_List_ViewModel item)
{
if(item != null)
{
if(item.Title.Contains(keyword))
{
return SearchType.Title;
}
if(item.Starring.Contains(keyword))
{
return SearchType.Starring;
}
}
return SearchType.None;
}
by using this method, I want to know each keyword belongs to which part of the Item in each result,but when I write "foreach" part it shows that there's a mistake in that line,but it didn't shows that what is the problem,so I realized that maybe I used the wrong way to return this automapper.
So is there anyone who can tell me what is the mistake did I made?