public ActionResult GlobalSearch(GlobalSearchBoxModel model) { switch (model.ObjectType) { case EntryType.Undefined: return(RedirectToAction("Index", "Search", new { filter = model.GlobalSearchTerm })); case EntryType.Album: return(RedirectToAction("Index", "Search", new { filter = model.GlobalSearchTerm, searchType = model.ObjectType })); case EntryType.Artist: return(RedirectToAction("Index", "Search", new { filter = model.GlobalSearchTerm, searchType = model.ObjectType })); case EntryType.ReleaseEvent: return(RedirectToAction("Index", "Search", new { filter = model.GlobalSearchTerm, searchType = model.ObjectType })); case EntryType.Song: return(RedirectToAction("Index", "Search", new { filter = model.GlobalSearchTerm, searchType = model.ObjectType })); case EntryType.SongList: return(RedirectToAction("Index", "Search", new { filter = model.GlobalSearchTerm, searchType = model.ObjectType })); default: var controller = model.ObjectType.ToString(); return(RedirectToAction("Index", controller, new { filter = model.GlobalSearchTerm })); } }
public ActionResult GlobalSearch(GlobalSearchBoxModel model) { string action, controller; if (model.ObjectType != EntryType.Undefined) { action = "Index"; controller = model.ObjectType.ToString(); } else { action = "Search"; controller = "Home"; } return(RedirectToAction(action, controller, new { filter = model.GlobalSearchTerm })); }