public ActionResult LocTheoTacGia(string id) { List <ThongTinSach> thongtin = new SachDao().listSach(); //var e = from a in thongtin where a.TenTL == id select a; var t = thongtin.Where(x => x.MaTG == id); ViewBag.tg = thongtin.Where(s => s.MaTG == id).Select(x => x.TenTG).First(); return(View(t.ToList())); }
public ActionResult LocTheoTheLoai(string id) { List <ThongTinSach> thongtin = new SachDao().listSach(); //var e = from a in thongtin where a.TenTL == id select a; var t = thongtin.Where(x => x.MaTL == id); if (t.ToList().Count == 0) { ViewBag.ThongBao = "Khong tim thay san pham nao"; return(View(thongtin)); } ViewBag.tl = thongtin.Where(s => s.MaTL == id).Select(x => x.TenTL).First(); return(View(t.ToList())); }