Exemple #1
0
        public async Task <HttpResponseMessage> Lista(HttpRequestMessage request, string producto = null)
        {
            return(await CreateHttpResponseAsync(request, async() =>
            {
                HttpResponseMessage response = null;
                string message = String.Empty;
                try
                {
                    var item = _productoService.GetProductosFiltro(producto);
                    response = request.CreateResponse(HttpStatusCode.OK, item);
                }
                catch (Exception ex)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest,
                                                      new
                    {
                        error = "ERROR",
                        message = ex.Message
                    });
                }

                return await Task.FromResult(response);
            }));
        }