public void Update(Item item) { CacheWrapper.Invalidate(() => { Item found = _items.FirstOrDefault(i => i.Id.Equals(item.Id)); if (null != found) { found.ItemName = item.ItemName; found.Quantity = item.Quantity; } }, cacheKey); }
public bool Add(Item item) { try { CacheWrapper.Invalidate(() => { _items.Add(item); }, cacheKey); } catch (Exception e) { //log e return(false); } return(true); }
public bool Delete(int id) { try { CacheWrapper.Invalidate(() => { Item found = _items.FirstOrDefault(i => i.Id.Equals(id)); if (null != found) { _items.Remove(found); } }, cacheKey); } catch (Exception e) { //log e return(false); } return(true); }