Пример #1
0
 public ShoppingListItemModel(ShoppingListItem item)
 {
     Id = item.Id;
     Name = item.Name;
     Aisle = item.Aisle;
     Quantity = item.Quantity;
     Price = item.Price;
     Picked = item.Picked;
 }
Пример #2
0
        protected internal virtual ShoppingListItem GetOrAddItem(string name)
        {
            var item = ShoppingListItems.SingleOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase));

            if (item == null)
            {
                item = new ShoppingListItem(this, name.ToTitleCase());
                _shoppingListItems.Add(item);
            }

            return item;
        }