public ShoppingCartItem GetById(int id, bool isCache = true) { ShoppingCartItem shoppingCartItem; if (isCache) { var sbKey = new StringBuilder(); sbKey.AppendFormat(CacheShoppingcartitemKey, "GetById"); sbKey.Append(id); var key = sbKey.ToString(); shoppingCartItem = _cacheManager.Get <ShoppingCartItem>(key); if (shoppingCartItem == null) { shoppingCartItem = _shoppingCartItemRepository.GetById(id); _cacheManager.Put(key, shoppingCartItem); } } else { shoppingCartItem = _shoppingCartItemRepository.GetById(id); } return(shoppingCartItem); }
public ShoppingCartItem GetById(int id) { return(_shoppingCartItemRepository.GetById(id)); }