Hello i want to sort my index page by selectedId Category using viewbag . I'm already use linq and implement search button is work but filtering category doesn't work.
This Index method on controller
public ActionResult Index(string Search, int Ca ) { //var c = User.Identity.GetUserId(); string c = System.Web.HttpContext.Current.User.Identity.GetUserId(); //int e = int.Parse(Request.Form["Ca"].ToString()); var test = (from s in db.Articles where (s.UserId == c) where (s.titre.Contains(Search)) where (s.Idc == int.Parse (Request["Ca"].ToString())) select s ).Distinct().ToList(); ViewBag.Ca = new SelectList(db.Categories, "Id", "libelle"); return View(test.ToList()); }
thanks