Пример #1
0
        public IEnumerable <Post> GetPosts()
        {
            IQueryable <Post> data;

            using (var db = new BalanceContext())
            {
                data = db.Posts.Where(p => p.Amount > 1);
                data.ToList();
            }
            return(data);
        }
Пример #2
0
        public bool AddPostToBalanceSheet(Post post)
        {
            int count = 0;

            using (var db = new BalanceContext())
            {
                var state = db.Posts.Add(post);
                count = db.SaveChanges();
            }
            return(count > 0);
        }
Пример #3
0
        public bool RemovePostFromBalanceSheet(Post post)
        {
            int count = 0;

            using (var db = new BalanceContext())
            {
                var result = db.Posts.Remove(post);
                count = db.SaveChanges();
            }

            return(count > 0);
        }