示例#1
0
        // Changes the total likes of a post based on actions.
        static void UpdateLikeCounter(int PostId, int Ammount)
        {
            snaptergramEntities db = new snaptergramEntities();

            posts ToChange = db.posts.Find(PostId);

            ToChange.likes          += Ammount;
            db.Entry(ToChange).State = EntityState.Modified;
            db.SaveChanges();
        }
示例#2
0
        // Changes a user's profile picture.
        public static bool UpdateProfilePicture(int UserId, string NewProfilePicture)
        {
            snaptergramEntities db = new snaptergramEntities();

            users ToChange = db.users.Find(UserId);

            ToChange.profilePic      = NewProfilePicture;
            db.Entry(ToChange).State = EntityState.Modified;
            db.SaveChanges();
            return(true);
        }