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();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add the tenant
        /// </summary>
        /// <param name="tenant"></param>
        public bool AddTenant(Tenant tenant)
        {
            //add tenant

            using (var connection = new SqlConnection(_conString))
            {
                var cmd = new SqlCommand("INSERT INTO TenantDetails (FirstName,Lastname, PhoneNumber) VALUES (@fName,@lName, @PhoneNo)")
                {
                    CommandType = CommandType.Text,
                    Connection = connection
                };
                cmd.Parameters.AddWithValue("@fName", tenant.FirstName);
                cmd.Parameters.AddWithValue("@lName", tenant.LastName);
                cmd.Parameters.AddWithValue("@PhoneNo", tenant.PhoneNumber);
                connection.Open();
                cmd.ExecuteNonQuery();
            }
            return true;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Update the tenant
 /// </summary>
 /// <param name="tenant"></param>
 public bool Update(Tenant tenant)
 {
     //add tenant
     return true;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Delete the tenant
 /// </summary>
 /// <param name="tenant"></param>
 public bool Delete(Tenant tenant)
 {
     //add tenant
     return true;
 }