public async Task <IEnumerable <BrandPaggingDTO> > GetlstBrandbyFiltter(ProductBrandFilter filter) { var output = new List <BrandPaggingDTO>(); try { var cacheKey = "Brand_GetlstBrandbyFiltter"; var redisEncode = await _distributedCache.GetStringAsync(cacheKey); if (redisEncode != null) { output = JsonConvert.DeserializeObject <List <BrandPaggingDTO> >(redisEncode); } else { var result = await _repoWrapper.Brand.GetListProductBrand(filter); output = _mapper.Map <List <BrandPaggingDTO> >(result); await _distributedCache.SetStringAsync(cacheKey, JsonConvert.SerializeObject(output), Utils.Util.RedisOptions()); } } catch (Exception ex) { _logger.LogError($"GetlstBrandbyFiltter: " + ex.ToString()); } return(output); }
public async Task <IEnumerable <ProductBrand_Search_Brand_V2_Result> > GetListProductBrand(ProductBrandFilter filter) { var Keyword = new SqlParameter("@Keyword", filter.Keyword); var StatusType_ID = new SqlParameter("@StatusType_ID", filter.StatusTypeId); var PageSize = new SqlParameter("@PageSize", filter.PageSize); var CurrentPage = new SqlParameter("@CurrentPage", filter.Page); var ProductType_ID = new SqlParameter("@ProductType_ID", filter.ProductTypeID); var ProductCategory_ID = new SqlParameter("@ProductCategory_ID", filter.ProductCategoryID); var AccesoryCategory_ID = new SqlParameter("@AccesoryCategory_ID", filter.AccesoryCategoryID); var Location_ID = new SqlParameter("@Location_ID", filter.LocationID); var result = await HanomaContext.Set <ProductBrand_Search_Brand_V2_Result>() .FromSqlRaw($"EXECUTE dbo.ProductBrand_Search_Brand_V2 " + $"@Keyword = @Keyword, " + $"@ProductType_ID = @ProductType_ID, " + $"@ProductCategory_ID = @ProductCategory_ID, " + $"@AccesoryCategory_ID = @AccesoryCategory_ID, " + $"@Location_ID = @Location_ID, " + $"@StatusType_ID = @StatusType_ID, " + $"@PageSize = @PageSize, " + $"@CurrentPage = @CurrentPage ", Keyword, ProductType_ID, ProductCategory_ID, AccesoryCategory_ID, Location_ID, StatusType_ID, PageSize, CurrentPage ) .AsNoTracking() .ToListAsync(); return(result); }