コード例 #1
0
        public HttpResponseMessage GetAllCategoriesOfAGroup(int categoryId)
        {
            HttpResponseMessage response;

            var list = _categoryServices.GetAllCategoriesOfAGroup(categoryId);

            response = Request.CreateResponse(HttpStatusCode.OK, list);

            return(response);
        }
コード例 #2
0
        //
        // GET: /Search/
        public ActionResult Index(AdvancedAdSearchModel model)
        {
            ViewBag.Categories = _categoryServices.GetAllCategoriesOfAGroup(model.CategorySelectedId)
                                 .Select(x => new SelectListItem {
                Text = x.Label, Value = x.Id.ToString()
            });

            // Equivalent to Search/Search?
            if (model.CategorySelectedId.HasValue)
            {
                AdSearchResultModel result = _searchServices.SearchAds(model);
                return(View(result));
            }
            // Equivalent to Search/QuickSearch? (when no categories)
            else
            {
                AdHomeSearchResultModel result = _searchServices.QuickSearch(model);
                return(View("QuickSearch", result));
            }
        }