public ActionResult <List <ProductDTO> > FindPromotion(int items) { //Get in cache var re = _cache.Get <List <ProductDTO> >(CacheKey.DISCOUNT_PRODUCT); if (re == null || re?.Count == 0) { //Get in db var products = GetListProducts(); if (products == null) { return(Problem(statusCode: 500, detail: "Data not exist")); } re = _productModel.FindPromotion(products); if (re == null) { return(Problem(statusCode: 500, detail: "Data not exist")); } _cache.Set(re, CacheKey.DISCOUNT_PRODUCT); } return(items <= 0 ? re : re.Take(items).ToList()); }