public async Task <Bookmark> Add(Bookmark bookmark)
        {
            using (var db = new StackoverflowDbContext())
            {
                await db.Bookmarks.AddAsync(bookmark);

                db.SaveChanges();
                return(bookmark);
            }
        }
Esempio n. 2
0
        public async Task <Question> Add(Question q)
        {
            using (var db = new StackoverflowDbContext())
            {
                await db.Questions.AddAsync(q);

                db.SaveChanges();
                return(q);
            }
        }
Esempio n. 3
0
        public async Task <Note> Add(Note note)
        {
            using (var db = new StackoverflowDbContext())
            {
                await db.Notes.AddAsync(note);

                db.SaveChanges();
                return(note);
            }
        }
        public async Task <Search> Add(Search newSearch)
        {
            using (var db = new StackoverflowDbContext())
            {
                await db.Searches.AddAsync(newSearch);

                db.SaveChanges();
                return(newSearch);
            }
        }
        public async Task <Comment> Add(int id, Comment comment)
        {
            using (var db = new StackoverflowDbContext())
            {
                comment.UserID = _user.ID;
                comment.PostID = id;
                await db.Comments.AddAsync(comment);

                db.SaveChanges();
                return(comment);
            }
        }