public IActionResult Index() { var brands = _service.GetCatalogBrands() .Select(b => new BrandDTO { Id = b.Id, Brand = b.Brand }).ToList(); var serializer = new Serializing(); var data = serializer.SerializeBinary(brands); return(Ok(data)); }
// GET api/<controller> public HttpResponseMessage Get() { var brands = _service.GetCatalogBrands() .Select(b => new BrandDTO { Id = b.Id, Brand = b.Brand }).ToList(); var serializer = new Serializing(); var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StreamContent(serializer.SerializeBinary(brands)) }; return(response); }