private void SaveReg() { GTI_Models.Models.Tributo reg = new GTI_Models.Models.Tributo { Desctributo = txtCompleto.Text, Abrevtributo = txtResumido.Text, Da = true }; Tributario_bll clsTributario = new Tributario_bll(_connection); Exception ex; if (bAddNew) { ex = clsTributario.Insert_Tributo(reg); } else { reg.Codtributo = Convert.ToInt16(lstMain.SelectedValue); ex = clsTributario.Alterar_Tributo(reg); } if (ex != null) { ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex); eBox.ShowDialog(); } else { Carrega_Lista(); ControlBehaviour(true); } }
public JsonResult Alterar_Tributo(string codigo, string nomeC, string nomeR) { short _codigo = Convert.ToInt16(codigo); Tributo reg = new Tributo() { Codtributo = _codigo, Desctributo = nomeC.ToUpper(), Abrevtributo = nomeR.ToUpper() }; Tributario_bll tributarioRepository = new Tributario_bll(_connection); Exception ex = tributarioRepository.Alterar_Tributo(reg); var result = new { Success = "True" }; return(new JsonResult { Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }