public ISeat FindReservedSeat(string firstName, string lastName)
        {
            var restaurants = MockDatabase.Restaurants();

            return(restaurants
                   .SelectMany(r => r.Sections)
                   .SelectMany(section => section.Tables)
                   .SelectMany(table => table.Seats)
                   .Where(seat => seat.IsOccupied)
                   .FirstOrDefault(seat => seat.Diner.FirstName.Equals(firstName) && seat.Diner.LastName.Equals(lastName)));
        }
Exemplo n.º 2
0
        public IList <IRestaurant> FindRestaurants(SearchQuery query)
        {
            var unreservedSeatInRestaurantQuery = query as UnreservedSeatInRestaurantQuery;

            if (unreservedSeatInRestaurantQuery == null)
            {
                throw new NotSupportedException(
                          $"Cannot execute query based on insufficient data: passed {query.GetType().Name} instead of {nameof(UnreservedSeatInRestaurantQuery)}");
            }

            return(MockDatabase.Restaurants().Where(r => r.Name.Equals(unreservedSeatInRestaurantQuery.Restaurant)).ToList <IRestaurant>());
        }
Exemplo n.º 3
0
 public IList <IRestaurant> FindRestaurants(SearchQuery query)
 {
     return(MockDatabase.Restaurants().ToList <IRestaurant>());
 }