count = db.books.Local.Count(x =>
(market_id == 0 || x.market_id != 0 && x.market_id == market_id)
&& (name == null || x.name != null && (x.name.StartsWith(name)));
count = db.books.Local.Select(x =>
(market_id == 0 || x.market_id != 0 && x.market_id == market_id)
&& (name == null || x.name != null && (x.name.StartsWith(name)).ToList().Count;