コード例 #1
0
        // GET: Source
        public async Task <ActionResult> Index(GetWithArticles.Request request)
        {
            if (ModelState.IsValid)
            {
                if (User.Identity.IsAuthenticated)
                {
                    request.Username = User.Identity.Name;
                }
                var response = await Handle(request);

                if (response.Source != null)
                {
                    return(View(response));
                }
            }
            TempData["ErrorMessage"] = "Source not found! Please try again.";
            return(RedirectToAction("Index", "Home"));
        }
コード例 #2
0
        public async Task <ActionResult> Index(GetWithArticles.Request request, string SearchTerm)
        {
            if (ModelState.IsValid)
            {
                if (User.Identity.IsAuthenticated)
                {
                    request.Username = User.Identity.Name;
                }

                var response = await Handle(request);

                if (response.Category != null)
                {
                    ViewBag.Title = "\"" + request.SearchTerm + "\" - Search | " + response.Category.Category.Name + " BlogBuddy";
                    return(View(response));
                }
            }
            TempData["ErrorMessage"] = "Category not found! Please try again.";
            return(RedirectToAction("Index", "Home"));
        }