Exemplo n.º 1
0
        // DELETE api/values/5
        public HttpResponseMessage Delete(int id)
        {
            HttpResponseMessage response;

            if (id <= 0)
            {
                response = Request.CreateResponse(HttpStatusCode.BadRequest);
                response.ReasonPhrase = "Invalid product";
            }
            else
            {
                _productProvider.DeleteProduct(id);
                response = Request.CreateResponse(HttpStatusCode.OK);
            }

            return(response);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> DeleteProduct([FromRoute] int id)
        {
            await _productProvider.DeleteProduct(id);

            return(Ok());
        }
Exemplo n.º 3
0
 public void DeleteProduct(int productId)
 {
     _productProvider.DeleteProduct(productId);
 }