Esempio n. 1
0
        // GET: api/Producto/5
        public IHttpActionResult Get([FromUri] int id)
        {
            var jresult = BL.GetProducto((int)id);

            if (jresult.Success)
            {
                return(Ok(jresult));
            }
            else
            {
                return(Ok(jresult));
            }
        }
Esempio n. 2
0
        public IActionResult Get(int id)
        {
            Producto producto = ProductoBL.GetProducto(id);

            if (producto == null)
            {
                return(NotFound());
            }
            return(Ok(JsonConvert.SerializeObject(producto, Formatting.Indented,
                                                  new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            })));
        }