// 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(); }
// 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); }