public IQueryable <ThietBi> GetBooks([QueryString("id")] int?categoryId) { var _db = new ThietBiOnLine.Models.ThietBiContext(); IQueryable <ThietBi> query = _db.ThietBis; if (categoryId.HasValue && categoryId > 0) { query = query.Where(p => p.HangID == categoryId); } return(query); }
public IQueryable <ThietBi> GetDetails([QueryString("bookID")] int?bookId) { var _db = new ThietBiOnLine.Models.ThietBiContext(); IQueryable <ThietBi> query = _db.ThietBis; if (bookId.HasValue && bookId > 0) { query = query.Where(p => p.ThietBiID == bookId); } else { query = null; } return(query); }