Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public Users UpdateUser(Users user)
 {
     db.Attach <Users>(user);
     db.Update <Users>(user);
     db.SaveChanges();
     return(user);
 }
Exemplo n.º 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);
        }
        //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);
        }