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

            VariantData variantData = new VariantData();
            var         data        = variantData.GetVariantById(id);

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

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

            VariantData    data    = new VariantData();
            VariantDBModel variant = data.GetVariantById(id);

            HttpResponseMessage response;

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

            return(response);
        }