예제 #1
0
        public bool addProfile(string sid, string name)
        {
            // code to add a new user profile to SQL database
            // creates a new instance of our database objects (user table in this case)

            using (var context = new ThemeParkData_Entities())
            {
                // add a new object (or row) to our user profile table
                context.Users.Add(new User()
                                  // bind each database column to the parameters we pass in our method
                                  // guid, firstname, surname, and email
                {
                    ServiceID = sid,
                    Name      = name,
                });

                // commit changes to the user profile table
                context.SaveChanges();
                return(true);
            }
        }
예제 #2
0
        public bool addProfile(string sid, string name)
        {
            // code to add a new user profile to SQL database
            // creates a new instance of our database objects (user table in this case)

            using (var context = new ThemeParkData_Entities())
            {
                // add a new object (or row) to our user profile table
                context.Users.Add(new User()
               // bind each database column to the parameters we pass in our method
               // guid, firstname, surname, and email
                {
                    ServiceID = sid,
                    Name = name,
                });

                // commit changes to the user profile table
                context.SaveChanges();
                return true;
            }
        }
예제 #3
0
        public bool addPhoto(int uid, int tpid, string photourl)
        {
            // code to add a new user profile to SQL database
            // creates a new instance of our database objects (user table in this case)
            using (var context = new ThemeParkData_Entities())
            {
                // add a new object (or row) to our user profile table
                context.Photos.Add(new Photo()
                                   // bind each database column to the parameters we pass in our method
                                   // guid, firstname, surname, and email
                {
                    UserID      = Convert.ToInt32(uid),
                    ThemeParkID = Convert.ToInt32(tpid),
                    PhotoURL    = photourl
                });

                // commit changes to the user profile table
                context.SaveChanges();
                return(true);
            }
        }
예제 #4
0
        public bool addPhoto(int uid, int tpid, string photourl)
        {
            // code to add a new user profile to SQL database
            // creates a new instance of our database objects (user table in this case)
            using (var context = new ThemeParkData_Entities())
            {
                // add a new object (or row) to our user profile table
                context.Photos.Add(new Photo()
                // bind each database column to the parameters we pass in our method
                // guid, firstname, surname, and email
                {
                    UserID = Convert.ToInt32(uid),
                    ThemeParkID = Convert.ToInt32(tpid),
                    PhotoURL = photourl
                });

                // commit changes to the user profile table
                context.SaveChanges();
                return true;
            }
        }