Exemplo n.º 1
0
        private void btn_edit_Click(object sender, EventArgs e)
        {
            People usertobeedit = db.Person.Find(idTobeEdit);

            usertobeedit.Name    = txt_name.Text;
            usertobeedit.Surname = txt_surname.Text;
            usertobeedit.Email   = txt_surname.Text;
            db.SaveChanges();
            UpdateDtgw();
            panel1.Visible = false;
        }
Exemplo n.º 2
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            string username   = txbx_email.Text.Trim();
            string fname      = txbx_surname.Text.Trim();
            string useremail  = txbx_email.Text.Trim();
            string pass       = txbx_password.Text.Trim();
            string repeadpass = txbx_comfpass.Text.Trim();

            People newperson = new People
            {
                Name     = username,
                Surname  = fname,
                Email    = useremail,
                Password = pass
            };

            if (!CheckInputValidation.CheckInputs(newperson))
            {
                MessageBox.Show("All input fields should be filled.");
                return;
            }

            if (newperson.Password != repeadpass)
            {
                MessageBox.Show("Password and repeat password don't match");
                return;
            }

            newperson.Password = Extention.HashPass(newperson.Password);


            db.Person.Add(newperson);
            db.SaveChanges();
            MessageBox.Show("Added");
        }