public IEnumerable<BagelChoice> GetSelection(BagelShopType bagelShopType) { var orderedChoices = Choices.OrderBy(x => x.Ordering); return orderedChoices.Where(x => x.Location.LocationId == (int) bagelShopType) .Concat( orderedChoices.Where(x => x.Location.LocationId != (int) bagelShopType)); }
public static BagelShop BuildIndividualShoppingList(BagelShopType bagelShopType, IEnumerable<Bageller> bagellers) { var shop = new BagelShop(bagelShopType); foreach (var bageller in bagellers) { shop.AddBagel(string.Join(",", bageller.GetSelection(bagelShopType).Select(x => x.Bagel))); } return shop; }
public BagelShop(BagelShopType type) { Type = type; Bagels = new List<Bagel>(); }