public static HotDog ConversionToHotDog(HotDogSQL hotDogSQL)
        {
            Ingredient bun     = CartConstants.OfflineIngredients.FirstOrDefault(x => x.Id == hotDogSQL.Bun);
            Ingredient sausage = CartConstants.OfflineIngredients.FirstOrDefault(x => x.Id == hotDogSQL.Sausage);
            Ingredient sauce0  = null;

            if (hotDogSQL.Sauce0 != null)
            {
                sauce0 = CartConstants.OfflineIngredients.FirstOrDefault(x => x.Id == hotDogSQL.Sauce0);
            }
            Ingredient sauce1 = null;

            if (hotDogSQL.Sauce1 != null)
            {
                sauce1 = CartConstants.OfflineIngredients.FirstOrDefault(x => x.Id == hotDogSQL.Sauce1);
            }
            Ingredient sauce2 = null;

            if (hotDogSQL.Sauce2 != null)
            {
                sauce2 = CartConstants.OfflineIngredients.FirstOrDefault(x => x.Id == hotDogSQL.Sauce2);
            }
            Ingredient topping0 = null;

            if (hotDogSQL.Topping0 != null)
            {
                topping0 = CartConstants.OfflineIngredients.FirstOrDefault(x => x.Id == hotDogSQL.Topping0);
            }
            Ingredient topping1 = null;

            if (hotDogSQL.Topping1 != null)
            {
                topping1 = CartConstants.OfflineIngredients.FirstOrDefault(x => x.Id == hotDogSQL.Topping1);
            }
            Ingredient topping2 = null;

            if (hotDogSQL.Topping2 != null)
            {
                topping2 = CartConstants.OfflineIngredients.FirstOrDefault(x => x.Id == hotDogSQL.Topping2);
            }

            HotDog hotDog = new HotDog
            {
                Id       = hotDogSQL.Id,
                Bun      = bun,
                Sausage  = sausage,
                Sauce0   = sauce0,
                Sauce1   = sauce1,
                Sauce2   = sauce2,
                Topping0 = topping0,
                Topping1 = topping1,
                Topping2 = topping2,
                Price    = hotDogSQL.Price,
                Order    = hotDogSQL.Order
            };

            return(hotDog);
        }
示例#2
0
 public HotDogDecorator(string n, HotDog hotdog)
     : base(n)
 {
     this.hotdog = hotdog;
 }
示例#3
0
 public SpiceDog(HotDog hotdog, Spice spice)
     : base(hotdog.Name + " " + spice.ToString(), hotdog)
 {
     this.spice = spice;
 }
示例#4
0
 public BunDog(HotDog hotdog, Bun bun)
     : base(hotdog.Name + " " + bun.ToString(), hotdog)
 {
     this.bun = bun;
 }