Example #1
0
        private void buttonsubmitadd_Click(object sender, EventArgs e)
        {
            Data.drivers.Add(new Models.Driver()
            {
                Name    = textBoxadddrivername.Text,
                Post    = textBoxadddriverpost.Text,
                CarType = textBoxadddrivercartype.Text
            });

            var drive = new Drivers();

            drive.Name    = textBoxadddrivername.Text;
            drive.Post    = textBoxadddriverpost.Text;
            drive.CarType = textBoxadddrivercartype.Text;

            zuber_Db.Drivers.Add(drive);
            zuber_Db.SaveChanges();


            this.Close();

            MessageBox.Show("New Driver Added");

            viewDriver.RefreshData();
        }
Example #2
0
        private void buttonaddnewadmin_Click(object sender, EventArgs e)
        {
            Data.admins.Add(new Models.Admins()
            {
                Name     = textBoxaddadminname.Text,
                Username = textBoxaddadminusername.Text,
                Password = textBoxaddadminpassword.Text
            });

            var Admn = new Admin();

            Admn.Name     = textBoxaddadminname.Text;
            Admn.Username = textBoxaddadminusername.Text;
            Admn.Password = textBoxaddadminpassword.Text;

            zuber_Db.Admin.Add(Admn);
            zuber_Db.SaveChanges();

            this.Close();

            MessageBox.Show("New Administrator Added");

            viewAdmins.RefreshData();
        }