0
Good afternoon, folks, I was wondering if anyone could assist me. My Web Service has a Get method that returns the entire list of Products, however I would like to create a method that it returns ONE Product according to a code that passed to it. At the moment all the method with parameter is returning me is a 404 when tested on Fiddler. Any idea? Any methods you have? any help is welcome thanks.
Code:
[Route("api/Produto")]
public class ProdutoConsultController : ApiController
{
// GET api/ProdutoConsult
public ObjectResult<uspConsultarProduto_Result> Get()
{
ControleDeEstoqueEntities entity = new ControleDeEstoqueEntities();
var result = entity.uspConsultarProduto(null);
return result;
}
// GET api/ProdutoConsult/5
public List<produto> Get(int cod)
{
ControleDeEstoqueEntities entity = new ControleDeEstoqueEntities();
List<produto> MyList = new List<produto>();
var result = from produto in entity.produto where produto.pro_cod == cod select produto;
MyList.AddRange(result);
return MyList;
}
Keep the question in its initial state, otherwise it loses its meaning.
– Jéf Bueno