Example #1
0
        public void RemoveStorItem(int id)
        {
            StoreItem item;

            if (storeItems.RemoveById(id, out item))
            {
                ItemRemoved?.Invoke(this, ViewConverter.CreateStoreItemView(item));
            }
        }
        public void TestAddStoreItem()
        {
            TestLogin();


            StoreItemView item = ViewConverter.CreateStoreItemView(book1);

            try
            {
                Logic.Instance.AddStoreItem(item);
            }catch (PrimeryKeyAllReadyExistException e)
            {
                Logger.Exception(e, "Testing add item.");
                Assert.Fail("Created an item with an all ready taken ISBN");
            }
        }
Example #3
0
        public IEnumerable <StoreItemControl> GetStoreItems(params Predicate <StoreItemView>[] predicates)
        {
            List <StoreItemControl> list = new List <StoreItemControl>();

            foreach (var item in storeItems.GetAll())
            {
                var  itemView = ViewConverter.CreateStoreItemView(item);
                bool fined    = true;
                foreach (var pred in predicates)
                {
                    if (!pred(itemView))
                    {
                        fined = false;
                        break;
                    }
                }
                if (fined)
                {
                    list.Add(ViewConverter.CreateStoreItemControl(item));
                }
            }
            return(list);
        }