Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         if (Request.QueryString["id"] != null)
         {
             int idTipoCombustivel = Convert.ToInt32(Request.QueryString["id"]);
             TipoCombustivelBLL tipoCombustivelBLL = new TipoCombustivelBLL();
             var tipoCombustivel = tipoCombustivelBLL.Buscar(idTipoCombustivel);
             txtId.Text = tipoCombustivel.Id.ToString();
         }
     }
 }
Exemplo n.º 2
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            TipoCombustivelModel model = new TipoCombustivelModel();

            model.Descricao = txtDescricao.Text;

            if (txtId.Text != string.Empty)
            {
                model.Id = Convert.ToInt32(txtId.Text);
            }

            var tipoCombustivelBLL = new TipoCombustivelBLL();

            tipoCombustivelBLL.Salvar(model);

            Response.Redirect("./Lista.aspx");
        }