Exemplo n.º 1
0
        public MethodResponse <Product> GetProductByName(string Nombre)
        {
            var response = new MethodResponse <Product>();

            try
            {
                var logic = new LogicEngine();
                var res   = logic.GetProductByName(Nombre);

                if (int.Parse(res.Code.ToString()) != 0)
                {
                    return(new MethodResponse <Product>()
                    {
                        Code = res.Code, Message = res.Message
                    });
                }
                response = res;

                return(response);
            }
            catch (Exception ex)
            {
                return(new MethodResponse <Product>()
                {
                    Code = -1, Message = "Ocurrio un error al extraer el producto: " + ex.Message
                });
            }
        }