Esempio n. 1
0
        public async Task<IActionResult> Search(string q = "", int p = 1)
        {
            if (string.IsNullOrWhiteSpace(q)) Redirect("/");
            var data = new PostData(Db);
            var model = await data.SearchAsync(q, p);
            if (model == null) Redirect("/");
            ViewBag.PageCount = data.PageCount;
            ViewBag.PageNo = p;
            ViewBag.PagingUrl = $"/Search?q={q}&p={{p}}";

            return View("Index", model);
        }