Example #1
0
        public async Task <bool> Update(Question q)
        {
            using (var db = new StackoverflowDbContext())
            {
                db.Questions.Update(q);
                await db.SaveChangesAsync();

                return(true);
            }
        }
        public async Task <bool> Update(Comment com)
        {
            using (var db = new StackoverflowDbContext())
            {
                db.Comments.Update(com);
                await db.SaveChangesAsync();

                return(true);
            }
        }
Example #3
0
        public async Task <bool> Update(Note updateNote)
        {
            using (var db = new StackoverflowDbContext())
            {
                db.Notes.Update(updateNote);
                await db.SaveChangesAsync();

                return(true);
            }
        }
        public async Task <bool> Delete(int postId)
        {
            using (var db = new StackoverflowDbContext())
            {
                var bookmark = await Get(postId);

                if (bookmark == null)
                {
                    return(false);
                }
                db.Bookmarks.Remove(bookmark);
                await db.SaveChangesAsync();

                return(true);
            }
        }
Example #5
0
        public async Task <bool> Delete(int id)
        {
            using (var db = new StackoverflowDbContext())
            {
                var q = await Get(id);

                if (q == null)
                {
                    return(false);
                }
                db.Questions.Remove(q);
                await db.SaveChangesAsync();

                return(true);
            }
        }
        public async Task <bool> Delete(int id)
        {
            using (var db = new StackoverflowDbContext())
            {
                var comment = await Get(id);

                if (comment == null)
                {
                    return(false);
                }
                db.Comments.Remove(comment);
                await db.SaveChangesAsync();

                return(true);
            }
        }
        public async Task <bool> Delete(int userId)
        {
            using (var db = new StackoverflowDbContext())
            {
                var search = await Get(userId);

                if (search == null)
                {
                    return(false);
                }
                db.Searches.Remove(search);
                await db.SaveChangesAsync();

                return(true);
            }
        }