Beispiel #1
0
        public void AddNewItem(OrderedItem orderedItem)
        {
            string nameIdentity = GetNameIdentity(orderedItem);

            // Destructure ordered item
            var res = identityList.Where( e => e.Identity == nameIdentity).FirstOrDefault();

            if (res == null)
            {
                ItemIdentity tmp = new ItemIdentity(
                    new Product(
                        orderedItem.Name,
                        orderedItem.Price,
                        orderedItem.Unit,
                        0,
                        orderedItem.Note),
                    orderedItem.Amount);

                // Create a new identity
                identityList.Add(tmp);
            }
            else
            {
                // Append identity
                res.AddNewAmount(orderedItem.Amount);
            }
        }
Beispiel #2
0
 public string GetNameIdentity(OrderedItem item)
 {
     return item.Name + item.Note + item.Unit;
 }