Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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;
            }
        }