Ejemplo n.º 1
0
    //protected void Button2_Click(object sender, EventArgs e) {
    //    Button b = sender as Button;
    //    int prodId = int.Parse(b.CommandName);
    //    ProductHandler ph = new ProductHandler();
    //    ph.DeleteProduct(prodId);
    //    Repeater1.DataBind();
    //}

    protected void Button2_Click(object sender, EventArgs e)
    {
        Button         b      = sender as Button;
        int            prodId = int.Parse(b.CommandName);
        ProductHandler ph     = new ProductHandler();

        ph.DeleteProduct(prodId);
        Repeater1.DataBind();
    }
Ejemplo n.º 2
0
        protected void tableProduct_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int    index     = e.RowIndex;
            string productId = tableProduct.Rows[index].Cells[3].Text;

            int id = Int32.Parse(productId);

            ProductHandler.DeleteProduct(id);
            Response.Redirect(Request.RawUrl);
        }
Ejemplo n.º 3
0
        public static Response DeleteProduct(int id)
        {
            Product p = ProductHandler.DeleteProduct(id);

            if (p == null)
            {
                return(new Response(false, "to-be-deleted product cannot be referenced in another table in the database"));
            }
            else
            {
                return(new Response(true));
            }
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> DeleteProduct([FromBody] Product product)
        {
            try
            {
                if (product != null)
                {
                    var response = await ProductHandler.DeleteProduct(product);

                    if (response != null)
                    {
                        return(Ok(response));
                    }
                }
                return(StatusCode(408, new ErrorResponse()
                {
                    Message = "Bad Request - Product data is null"
                }));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                return(StatusCode(505, ex.Message));
            }
        }
Ejemplo n.º 5
0
        public static Response DeleteProduct(int ProductID)
        {
            Response response = ProductHandler.DeleteProduct(ProductID);

            return(response);
        }
 public async Task <ActionResult <ProductDTO> > DeleteProduct(int ID)
 {
     return(await m_Handler.DeleteProduct(ID));
 }
Ejemplo n.º 7
0
 public void DeleteProduct(string code)
 {
     _productHandler.DeleteProduct(code);
 }
Ejemplo n.º 8
0
        // Delete: Deletes specified product's information from database
        public IActionResult Delete(int id)
        {
            handler.DeleteProduct(id);

            return(RedirectToAction("Index"));
        }