Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     var tenant = new TenantRepository();
     ddTenant.DataSource = tenant.GetAllTenant();
     ddTenant.DataTextField = "FirstName";
     ddTenant.DataValueField = "id";
     ddTenant.DataBind();
 }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Tenant tenant = new Tenant
            {
                FirstName = txtFirstName.Text,
                LastName = txtLastName.Text,
                PhoneNumber = txtPhoneNumber.Text
            };

            TenantRepository tenantRepository = new TenantRepository();
            tenantRepository.Add(tenant);
            grdTenant.DataSource = null;
            grdTenant.DataSource = tenantRepository.GetAllTenant();
            grdTenant.DataBind();
        }