Ejemplo n.º 1
0
        // GET: api/Producto/5
        public GenericResponse <ProductoDto> Get(int id)
        {
            GenericResponse <ProductoDto> response = new GenericResponse <ProductoDto>();

            try
            {
                ProductoDto data = servicio.BuscarPorId(id);
                response.Data    = data;
                response.Codigo  = 200; // OK
                response.Error   = false;
                response.Mensaje = "OK";
            }
            catch (Exception ex)
            {
                throw new CustomResponseException(ex.Message, 500);
            }

            return(response);
        }