public ActionResult BasicSearch(BasicSearch model) { string keyword; if (model.Keyword.IsNullOrWhiteSpace()) { keyword = ""; } else { keyword = model.Keyword; } keyword = keyword.Trim(); ViewData["listEvent"] = EventDatabaseHelper.Instance.GetThumbEventListByListEvent( EventDatabaseHelper.Instance.SearchEventByKeyword(keyword)); ViewData["listLiveStream"] = EventDatabaseHelper.Instance.GetThumbEventListByListEvent( EventDatabaseHelper.Instance.SearchLiveStreamByKeyword(keyword)); ViewData["listUser"] = UserDatabaseHelper.Instance.SearchUserByKeyword(keyword); return View("SearchResult"); }
public ActionResult BasicSearch(BasicSearch model, int tab = -1) { User user = UserHelpers.GetCurrentUser(Session); if (user == null) { if (Request.Cookies["userName"] != null && Request.Cookies["password"] != null) { string userName = Request.Cookies["userName"].Value; string password = Request.Cookies["password"].Value; if (UserDatabaseHelper.Instance.ValidateUser(userName, password)) { user = UserDatabaseHelper.Instance.GetUserByUserName(userName); if (UserDatabaseHelper.Instance.isLookedUser(user.UserName)) { TempData["errorTitle"] = "Locked User"; TempData["errorMessage"] = "Your account is locked! Please contact with our support"; return RedirectToAction("Index", "Home"); } UserHelpers.SetCurrentUser(Session, user); } } } string keyword; if (model.Keyword.IsNullOrWhiteSpace()) { keyword = ""; } else { keyword = model.Keyword; } keyword = keyword.Trim(); TempData["TabSearch"] = tab; Session["listEvent"] = EventDatabaseHelper.Instance.GetThumbEventListByListEvent( EventDatabaseHelper.Instance.SearchEventByKeyword(keyword)); Session["listLiveStream"] = EventDatabaseHelper.Instance.GetThumbEventListByListEvent( EventDatabaseHelper.Instance.SearchLiveStreamByKeyword(keyword)); Session["listUser"] = UserDatabaseHelper.Instance.GetUserThumbByList(UserDatabaseHelper.Instance.SearchUserByKeyword(keyword)); TempData["task"] = "Search"; return View("SearchResult"); }