protected void btnEnviar_Click(object sender, EventArgs e) { CustomersComponent custc = new CustomersComponent(); Customers cust = null; if (Id > 0) { cust = custc.getCustomer(Id); cust.Name = txtName.Text; Category category = custc.GetCategory( int.Parse(ddlCategories.SelectedValue)); cust.Category = category; custc.UpdateCustomer(cust); } else { // agregar cust = new Customers(); cust.Name = txtName.Text; Category category = custc.GetCategory( int.Parse(ddlCategories.SelectedValue)); cust.Category = category; custc.CreateCustomer(cust); } Response.Redirect("Default.aspx"); }
private void LoadCustomer() { CustomersComponent custc = new CustomersComponent(); Customers cust = custc.getCustomer(Id); txtName.Text = cust.Name; ddlCategories.SelectedValue = cust.Category.Id.ToString(); }