コード例 #1
0
        //Updates a Post in Posts Table
        public Posts UpdatePost(int postId, string postText, string postImage)
        {
            Posts post = db.Posts.SingleOrDefault(e => e.PostId == postId);

            post.PostText  = postText;
            post.PostImage = postImage;
            db.Update(post);
            db.SaveChanges();
            return(post);
        }
コード例 #2
0
 public Users UpdateUser(Users user)
 {
     db.Attach <Users>(user);
     db.Update <Users>(user);
     db.SaveChanges();
     return(user);
 }
コード例 #3
0
        //Updates a comment in the Comments Table
        public Comments UpdateComment(int commentId, string commentText)
        {
            Comments comment = db.Comments.SingleOrDefault(e => e.CommentId == commentId);

            comment.CommentText = commentText;
            db.Update(comment);
            db.SaveChanges();
            return(comment);
        }
コード例 #4
0
        //Updates Location information in Locations Table
        public Locations UpdateLocation(int locationId, string address, string city, string country)
        {
            Locations locations = db.Locations.SingleOrDefault(e => e.LocationId == locationId);

            locations.Address = address;
            locations.City    = city;
            locations.Country = country;
            db.Update(locations);
            db.SaveChanges();
            return(locations);
        }