protected void btnEdit_Click(object sender, EventArgs e) { Osoba osoba; int mail = 0; if (ddlEmail.SelectedValue == "0") { osoba = new Osoba { IDOsoba = int.Parse(IDOsoba.Value), Ime = tbIme.Text, Prezime = tbPrezime.Text, Email = tbEmail.Text, Telefon = tbTelefon.Text, Lozinka = tbLozinka.Text, Status = int.Parse(ddlStatus.SelectedValue), Grad = ddlGrad.SelectedValue }; mail = 1; } else if (ddlEmail.SelectedValue == "1") { osoba = new Osoba { IDOsoba = int.Parse(IDOsoba.Value), Ime = tbIme.Text, Prezime = tbPrezime.Text, Email2 = tbEmail.Text, Telefon = tbTelefon.Text, Lozinka = tbLozinka.Text, Status = int.Parse(ddlStatus.SelectedValue), Grad = ddlGrad.SelectedValue }; mail = 2; } else { osoba = new Osoba { IDOsoba = int.Parse(IDOsoba.Value), Ime = tbIme.Text, Prezime = tbPrezime.Text, Email3 = tbEmail.Text, Telefon = tbTelefon.Text, Lozinka = tbLozinka.Text, Status = int.Parse(ddlStatus.SelectedValue), Grad = ddlGrad.SelectedValue }; mail = 3; } OnUpdateClick.Invoke(osoba, mail); }
// ---------- UPDATE USER EVENT ---------- protected void btnUpdate_Click(object sender, EventArgs e) { OnUpdateClick?.Invoke(new User { IDUser = myUser.IDUser, FirstName = txtFirstName.Text, LastName = txtLastName.Text, Telephone = txtTelephone.Text, Password = txtPassword.Text, Emails = myUser.Emails, City = (Cities)Enum.Parse(typeof(Cities), ddlCity.SelectedItem.Text), IsAdmin = (ddlStatus.SelectedItem.Text == "Administrator") }); }