Exemplo n.º 1
0
        private void Botton_Add_SesInfo_Click(object sender, EventArgs e)
        {
            BookingAppContext bc = new BookingAppContext();
            Gymsession        g  = new Gymsession();

            g.gid         = TextB_SesID_SesInfo.Text;
            g.gtitle      = TextB_Title_SesInfo.Text;
            g.gdate       = Date_Time_Date_SesInfo.Text;
            g.gmax_spots  = TextB_Spots_SesInfo.Text;
            g.ginstructor = TextB_Instructor_SesInfo.Text;

            try
            {
                bc.Gymsessions.Add(g);
                bc.SaveChanges();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Varning det blev fel");
            }



            /*
             * string cs = null;
             * SqlConnection cnn = new SqlConnection(cs);
             * SqlCommand cmd;
             * string sql = null;
             *
             * cs = "Data Source=LAPTOP-SCJU4H3Q;Initial Catalog=hatoca-inlamning;Integrated Security= SSPI;User ID=hatoca;Password=hatoca123;";
             *
             * try
             * {
             * cnn.Open();
             * cmd = new SqlCommand(sql, cnn);
             * cmd.ExecuteNonQuery();
             * cmd.Dispose();
             * cnn.Close();
             * MessageBox.Show("ExecuteNonQuery in SqlCommand executed!!");
             * }
             * catch (Exception ex)
             * {
             * MessageBox.Show("Could not open SqlConnection!");*/
        }
Exemplo n.º 2
0
        public void InitializeTypes()
        {
            if (_context.EventTypes.Any())
            {
                return;
            }

            _context.EventTypes.AddRange(
                new EventType
            {
                Type = "Football Match"
            },

                new EventType
            {
                Type = "Basketball Match"
            },

                new EventType
            {
                Type = "Concert"
            },

                new EventType
            {
                Type = "Party"
            },

                new EventType
            {
                Type = "Art"
            },

                new EventType
            {
                Type = "Convention"
            }
                );
            _context.SaveChanges();
        }
Exemplo n.º 3
0
 public void Add(Business data)
 {
     _context.Businesses.Add(data);
     _context.SaveChanges();
 }
Exemplo n.º 4
0
 public void Add(Schedule data)
 {
     _context.Schedules.Add(data);
     _context.SaveChanges();
 }
Exemplo n.º 5
0
 public void Add(User data)
 {
     _context.Users.Add(data);
     _context.SaveChanges();
 }
Exemplo n.º 6
0
 public void Add(Reservation data)
 {
     _context.Reservations.Add(data);
     _context.SaveChanges();
 }