public CartItem GetCartItem() { var dish = GetDish(); var cartItem = new CartItem { CartId = "cart", CartItemId = 1, DishId = dish.DishId, Dish = dish }; var a = new Ingredient { IngredientId = 1, PriceIfExtra = 5, Name = "Morot" }; var b = new Ingredient { IngredientId = 2, PriceIfExtra = 5, Name = "Sallad" }; var c = new Ingredient { IngredientId = 3, PriceIfExtra = 5, Name = "Gurka" }; var aCartItemIngredient = new CartItemIngredients { CartItem = cartItem, CartItemId = 1, Ingredient = a, IngredientId = a.IngredientId }; var bCartItemIngredient = new CartItemIngredients { CartItem = cartItem, CartItemId = 1, Ingredient = b, IngredientId = b.IngredientId }; var cCartItemIngredient = new CartItemIngredients { CartItem = cartItem, CartItemId = 1, Ingredient = c, IngredientId = c.IngredientId }; cartItem.CartItemIngredients.Add(aCartItemIngredient); cartItem.CartItemIngredients.Add(bCartItemIngredient); cartItem.CartItemIngredients.Add(cCartItemIngredient); return(cartItem); }
public Cart GetCart() { var a = new Ingredient { IngredientId = 1, PriceIfExtra = 5, Name = "Morot" }; var b = new Ingredient { IngredientId = 2, PriceIfExtra = 5, Name = "Sallad" }; var c = new Ingredient { IngredientId = 3, PriceIfExtra = 5, Name = "Gurka" }; var sallad = new Category { CategoryId = 1, Name = "Sallad" }; var dish = new Dish { Name = "Cesar sallad", Category = sallad, DishId = 1, Price = 40, DishIngredients = new List <DishIngredient>() }; var cartItem = new CartItem { CartId = "cart", CartItemId = 1, DishId = dish.DishId, Dish = dish }; var cartItemList = new List <CartItem>(); cartItemList.Add(cartItem); var aCartItemIngredient = new CartItemIngredients { CartItem = cartItem, CartItemId = 1, Ingredient = a, IngredientId = a.IngredientId }; var bCartItemIngredient = new CartItemIngredients { CartItem = cartItem, CartItemId = 1, Ingredient = b, IngredientId = b.IngredientId }; var cCartItemIngredient = new CartItemIngredients { CartItem = cartItem, CartItemId = 1, Ingredient = c, IngredientId = c.IngredientId }; cartItem.CartItemIngredients.Add(aCartItemIngredient); cartItem.CartItemIngredients.Add(bCartItemIngredient); cartItem.CartItemIngredients.Add(cCartItemIngredient); var cart = new Cart { CartId = "cart", CartItems = cartItemList }; return(cart); }