public async Task <string> SearchBrands([FromBody] string json) { var parser = new Parser(json); var phrase = parser.AsString("Phrase"); var sortType = parser.AsInt("SortType"); var page = parser.AsInt("Page"); var pageSize = parser.AsInt("PageSize"); var col = await _brandRepository.SearchBrands(phrase, sortType, page, pageSize); col.ForEach(b => { b.Products = null; }); object result = new { Brands = col, Total = await _brandRepository.CountBrands(phrase, sortType) }; return(JsonConvert.SerializeObject(result, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore })); }