public SeatingOptionSuggested SuggestSeatingOptionFor(SuggestionRequest suggestionRequest) { foreach (var row in _rows.Values) { var seatingOption = row.SuggestSeatingOption(suggestionRequest); if (seatingOption.MatchExpectation()) { return(seatingOption); } } return(new SeatingOptionNotAvailable(suggestionRequest)); }
public SeatingOptionSuggested SuggestSeatingOption(SuggestionRequest suggestionRequest) { var seatingOptionSuggested = new SeatingOptionSuggested(suggestionRequest); var availableSeatsCompliant = Seats.SelectAvailableSeatsCompliant(suggestionRequest.PricingCategory); var rowSize = Seats.Count(); var adjacentSeatsOfExpectedSize = availableSeatsCompliant.SelectAdjacentSeats(suggestionRequest.PartyRequested); var adjacentSeatsOrdered = adjacentSeatsOfExpectedSize.OrderByMiddleOfTheRow(rowSize); foreach (var adjacentSeats in adjacentSeatsOrdered) { seatingOptionSuggested.AddSeats(adjacentSeats); if (seatingOptionSuggested.MatchExpectation()) { return(seatingOptionSuggested); } } return(new SeatingOptionNotAvailable(suggestionRequest)); }
public SeatingOptionSuggested(SuggestionRequest suggestionRequest) { PartyRequested = suggestionRequest.PartyRequested; PricingCategory = suggestionRequest.PricingCategory; }