public IEnumerable <Kitten> GetFluffyKittens() { using (var db = new KittenEntities()){ // db can also be injected, return(db.Kittens // this explicit query is here .Where(kitten => kitten.fluffiness > 10) .Select(kitten => new { Name = kitten.name, Url = kitten.imageUrl }).Take(10)); } }
public IEnumerable <Kitten> GetLatestKittens(int fluffinessIndex = 10) { using (var db = new KittenEntities()) { return(db.Kittens // this explicit query is here .Where(kitten => kitten.fluffiness > 10) .Select(kitten => new { Name = kitten.name, Url = kitten.imageUrl }).Take(10)); } }