Пример #1
0
        public virtual ShoppingListItem AsShoppingListItem()
        {
            if (Ingredient != null)
            {
                return(new ShoppingListItem(Ingredient.AsIngredient())
                {
                    Id = ItemId,
                    Amount = (Qty.HasValue && Unit.HasValue) ? new Amount(Qty.Value, Unit.Value) : null,
                    Recipe = Recipe != null?Recipe.AsRecipeBrief() : null,
                                 CrossedOut = CrossedOut
                });
            }

            return(new ShoppingListItem(Raw)
            {
                Id = ItemId,
                CrossedOut = CrossedOut
            });
        }