예제 #1
0
        public bool Remove(Post obj)
        {
            CommentsFromPostsRepository commentsRepository = new CommentsFromPostsRepository(new SocialNetworkContext());

            try
            {
                _dbSet.Remove(obj);
                _socialNetworkContext.SaveChanges();

                var result = commentsRepository.RemoveCommentsFromPost(obj.Id);

                return(result);
            }
            catch
            {
                return(false);
            }
        }
예제 #2
0
        public bool UpDate(Profile profile)
        {
            try
            {
                PostRepository p = new PostRepository(new SocialNetworkContext());
                CommentsFromPostsRepository c = new CommentsFromPostsRepository(new SocialNetworkContext());

                p.UpdatePhoto(profile.Id, profile.UrlPhoto);
                c.UpdatePhoto(profile.Id, profile.UrlPhoto);

                _socialNetworkContext.Entry(profile).State = EntityState.Modified;
                _socialNetworkContext.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }