Ejemplo n.º 1
0
        public void UpdateUser(FrameworkTables.User user)
        {
            SovaContext db = new SovaContext();

            db.Update(user);
            db.SaveChanges();
        }
Ejemplo n.º 2
0
        //update comment
        public void UpdateComment(Comment comment)
        {
            SovaContext db = new SovaContext();

            db.Comments.Update(comment);
            db.SaveChanges();
        }
Ejemplo n.º 3
0
        //update post
        public void UpdatePost(Post post)
        {
            SovaContext db = new SovaContext();

            db.Posts.Update(post);
            db.SaveChanges();
        }
Ejemplo n.º 4
0
        public List <FrameworkTables.User> GetUsers(PagingAttributes pagingAttributes)
        {
            SovaContext db = new SovaContext();

            return(db.FrameworkUsers
                   .Skip(pagingAttributes.Page * pagingAttributes.PageSize)
                   .Take(pagingAttributes.PageSize).ToList());
        }
Ejemplo n.º 5
0
        ///////////////////////
        //
        // Posts
        //
        ///////////////////////

        // Gets All Posts
        public IList <Post> GetPosts(PagingAttributes pagingAttributes)
        {
            SovaContext db = new SovaContext();

            return(db.Posts.Skip(pagingAttributes.Page * pagingAttributes.PageSize)
                   .Take(pagingAttributes.PageSize)
                   .ToList());
        }
Ejemplo n.º 6
0
        ///////////////////////
        //
        // Users
        //
        ///////////////////////

        // Gets All GetUsers
        public IList <User> QAGetUsers(PagingAttributes pagingAttributes)
        {
            SovaContext db = new SovaContext();

            return(db.Users.Skip(pagingAttributes.Page * pagingAttributes.PageSize)
                   .Take(pagingAttributes.PageSize)
                   .ToList());
        }
Ejemplo n.º 7
0
        //create new post
        public void CreatePost(Post post)
        {
            SovaContext db = new SovaContext();

            post.Id           = db.Posts.Max(x => x.Id) + 1;
            post.CreationDate = DateTime.Now;
            db.Add(post);
            db.SaveChanges();
        }
Ejemplo n.º 8
0
        //create new comment
        public void CreateComment(Comment comment)
        {
            SovaContext db = new SovaContext();

            comment.Id         = db.Comments.Max(x => x.Id) + 1;
            comment.CreateDate = DateTime.Now;
            db.Add(comment);
            db.SaveChanges();
        }
Ejemplo n.º 9
0
        //delete comment
        public bool DeleteComment(int commentId)
        {
            SovaContext db      = new SovaContext();
            var         comment = db.Comments.Find(commentId);

            if (comment == null)
            {
                return(false);
            }
            db.Remove(comment);
            db.SaveChanges();
            return(true);
        }
Ejemplo n.º 10
0
        public bool DeleteUser(int userId)
        {
            SovaContext db   = new SovaContext();
            var         user = db.FrameworkUsers.Find(userId);

            if (user == null)
            {
                return(false);
            }
            db.Remove(user);
            db.SaveChanges();
            return(true);
        }
Ejemplo n.º 11
0
        //delete post
        public bool DeletePost(int postId)
        {
            SovaContext db   = new SovaContext();
            var         post = db.Posts.Find(postId);

            if (post == null)
            {
                return(false);
            }
            db.Remove(post);
            db.SaveChanges();
            return(true);
        }
Ejemplo n.º 12
0
        public void CreateUser(FrameworkTables.User user)
        {
            SovaContext db      = new SovaContext();
            var         tmpList = db.Users.ToList();

            if (tmpList.Count() == 0)
            {
                user.Id = 1;
            }
            else
            {
                user.Id = db.FrameworkUsers.Max(x => x.Id) + 1;
            }
            db.Add(user);
            db.SaveChanges();
        }
Ejemplo n.º 13
0
        // get comment by id
        public Comment GetComment(int commentId)
        {
            SovaContext db = new SovaContext();

            return(db.Comments.Find(commentId));
        }
Ejemplo n.º 14
0
        public LinkPost GetLinkPostId(int linkId)
        {
            SovaContext db = new SovaContext();

            return(db.LinkPosts.Find(linkId));
        }
Ejemplo n.º 15
0
        public int NumberGetLinkPost()
        {
            var db = new SovaContext();

            return(db.LinkPosts.Count());
        }
Ejemplo n.º 16
0
        public int NumberOfUsers()
        {
            var db = new SovaContext();

            return(db.Users.Count());
        }
Ejemplo n.º 17
0
        // Gets Number Of Posts
        public int NumberOfPosts()
        {
            var db = new SovaContext();

            return(db.Posts.Count());
        }
Ejemplo n.º 18
0
        public FrameworkTables.User GetUser(int userId)
        {
            SovaContext db = new SovaContext();

            return(db.FrameworkUsers.Find(userId));
        }
Ejemplo n.º 19
0
        //Get a post by Id
        public User QAGetUser(int userId)
        {
            SovaContext db = new SovaContext();

            return(db.Users.Find(userId));
        }
Ejemplo n.º 20
0
        ///////////////////////
        //
        // Linkpost
        //
        ///////////////////////

        // Gets All LinkPosts

        // Gets Number Of Comments
        public int NumberOfComments()
        {
            var db = new SovaContext();

            return(db.Comments.Count());
        }
Ejemplo n.º 21
0
        //Get a post by Id
        public Post GetPost(int postId)
        {
            SovaContext db = new SovaContext();

            return(db.Posts.Find(postId));
        }
Ejemplo n.º 22
0
        public int numOfPages()
        {
            SovaContext db = new SovaContext();

            return(db.FrameworkUsers.Count());
        }