public SearchResultsViewModel(WebTVSearchResult res, string url)
 {
     URL = url;
     Score = res.Score;
     Type = (SearchResultType)(res.Type + 100);
     Title = GetTitle(res);
 }
        private string GetTitle(WebTVSearchResult result)
        {
            switch (result.Type)
            {
                case WebTVSearchResultType.Recording:
                    return String.Format(FormStrings.SearchResultRecording, result.Title, result.StartTime);
                case WebTVSearchResultType.Schedule:
                    return String.Format(FormStrings.SearchResultSchedule, result.Title);
                case WebTVSearchResultType.TVGroup:
                    return String.Format(FormStrings.SearchResultChannelGroup, result.Title);
                case WebTVSearchResultType.Program:
                    return String.Format(FormStrings.SearchResultProgram, result.Title, result.StartTime, result.ChannelName);

                default:
                    return result.Title;
            }
        }
예제 #3
0
 private string CreateLink(WebTVSearchResult result)
 {
     switch (result.Type)
     {
         case WebTVSearchResultType.Program:
             return Url.Action("ProgramDetails", "Television", new { programId = result.Id });
         case WebTVSearchResultType.Recording:
             return Url.Action("Recording", "Television", new { id = result.Id });
         case WebTVSearchResultType.Schedule:
             return Url.Action("Schedules", "Television");
         case WebTVSearchResultType.TVChannel:
             return Url.Action("WatchLiveTV", "Television", new { channelId = result.Id });
         case WebTVSearchResultType.TVGroup:
             return Url.Action("TVGuide", "Television", new { group = result.Id });
         default:
             return null;
     }
 }