public JsonResult ExcluirProduto(int Codigo) { try { ProdutoDal d = new ProdutoDal(); d.Delete(d.FindById(Codigo)); return(Json("Produto excluido com sucesso.")); } catch (Exception ex) { return(Json(ex.Message)); } }
public JsonResult ExcluirProduto(int Codigo) { try { ProdutoDal d = new ProdutoDal(); d.Delete(d.FindById(Codigo)); return Json("Produto excluido com sucesso."); } catch (Exception ex) { return Json(ex.Message); } }
protected void btnExclusao_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(lblCodigo.Text); ProdutoDal d = new ProdutoDal(); d.Delete(id); lblMensagem.Text = "Produto excluido com sucesso."; painel.Visible = false; } catch (Exception ex) { lblMensagem.Text = ex.Message; } }