示例#1
0
        public JsonResult DoCareerSearch(string searchText)
        {
            var results = new List<spGetCareerListByName_Result>();
            using (var ctx = new CareersEntities())
            {
                var careers = ctx.spGetCareerListByName(searchText);
                results = careers.ToList();
            }

            return Json(new AjaxResponse { success = true, data = results });
        }
示例#2
0
        public ActionResult Search(string searchText)
        {
            var model = new CareerSearchModel();
            if (CookieHelper.CookieExists(AppConstants.CareerIdCookieName))
            {
                var careerId = Convert.ToInt32(CookieHelper.GetCookie(AppConstants.CareerIdCookieName));
                model.RelatedOccupations = CareerService.GetRelatedOccupations(careerId);
            }

            model.SearchText = searchText;

            if (!String.IsNullOrEmpty(model.SearchText))
            {
                using (var ctx = new CareersEntities())
                {
                    var careers = ctx.spGetCareerListByName(model.SearchText);
                    model.SearchResults = careers.ToList();
                }
            }

            return View(model);
        }