Exemplo n.º 1
0
        internal bool DoesBrandExist(int id)
        {
            bool exist = true;

            BrandData brandData = new BrandData();
            var       data      = brandData.GetBrandById(id);

            if (data == null)
            {
                exist = false;
            }

            return(exist);
        }
        public HttpResponseMessage Get(int id)
        {
            if (id <= 0)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, new { Message = "Id parameter must be greater than 0." }));
            }

            BrandData    data  = new BrandData();
            BrandDBModel brand = data.GetBrandById(id);

            HttpResponseMessage response;

            if (brand == null)
            {
                response = Request.CreateResponse(HttpStatusCode.NotFound, new { Message = "No data found matching given id." });
            }
            else
            {
                response = Request.CreateResponse(HttpStatusCode.OK, brand);
            }

            return(response);
        }