private ResultModel GetSearchResult(SearchModel request) { var search = request.Text.Safe(); if (string.IsNullOrWhiteSpace(search)) return new ResultModel(); try { var html = BaseUri.Combine("search.php").Upload(new NameValueCollection {{"search", search}}); return new ResultModel {Games = GetGames(html)}; } catch (Exception e) { return new ResultModel {Error = e.Message}; } }
public ActionResult Index(SearchModel model) { ViewBag.Search = model; return View(GetSearchResult(model)); }