Exemple #1
0
        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));
        }
Exemple #2
0
        // 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);
        }