Exemplo n.º 1
0
        public HttpResponseMessage GetProductsOnLowStocks(int id)
        {
            try
            {
                if (string.IsNullOrEmpty(id.ToString()))
                {
                    throw new Exception(ErrorMessageConstants.StockAmountEmpty);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, _productsManager.FindProducts(x => x.UnitsInStock <= id)));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.ToString()));
            }
        }