예제 #1
0
        public static Receipt AddReceipt(Receipt receipt)
        {
            var rec = new Receipt(Helpers.GenerateId(ListOfReceipts), receipt.Name, receipt.Description);

            receipt.Ingredients.ForEach(i => {
                rec.AddIngredientToReceipt(i);
                if (!ExistsInIngredientsList(i.Name))
                {
                    AddIngredient(i.Name, i.UnitMeasure);
                }
            });
            ListOfReceipts.Add(rec);
            return(rec);
        }