public ActionResult searchCase(string searchTxt) { if (HttpContext.User.Identity.IsAuthenticated) { //登陆后返回给用户相应的信息 CaseInfoList dbUserCase = new CaseInfoList(); var usercase = dbUserCase.GetUserCase(HttpContext.User.Identity.Name); ViewBag.UserCase = usercase; } CaseInfoList dbcase = new CaseInfoList(); var caselist = dbcase.HomeCaseList().Where(t => t.casetitle.Contains(searchTxt) || t.casecontent.Contains(searchTxt)).ToList(); return(View("Index", caselist)); }
/// <summary> /// 首页话题 /// </summary> /// <returns></returns> public ActionResult Index() { //判断用户是都已经登录 if (HttpContext.User.Identity.IsAuthenticated) { //登陆后返回给用户相应的信息 CaseInfoList dbUserCase = new CaseInfoList(); var usercase = dbUserCase.GetUserCase(HttpContext.User.Identity.Name); ViewBag.UserCase = usercase; } //公共信息 CaseInfoList dbcase = new CaseInfoList(); var caselist = dbcase.HomeCaseList(); //var temp = caselist.FirstOrDefault().commentlist.Count(); return(View(caselist)); }