public async Task AddCommentAsync(Comment comment)
        {
            comment.PostedOn = DateTime.Now;
            comment.Post.CountComments++;
            _db.Comments.Add(comment);

            await _db.SaveChangesAsync();
        }
Example #2
0
        public async Task <Post> AddPostAsync(Post post)
        {
            _db.Entry(post).State = EntityState.Detached;
            var result = _db.Posts.Add(post);
            await _db.SaveChangesAsync();

            return(result);
        }
Example #3
0
        public async Task SaveAsync()
        {
            await _db.SaveChangesAsync();

            Dispose();
        }
Example #4
0
 public async Task AddTagAsync(Tag tag)
 {
     _db.Tags.Add(tag);
     await _db.SaveChangesAsync();
 }
 public async Task CreatePortfolioAsync(Portfolio portfolio)
 {
     _db.Portfolios.Add(portfolio);
     await _db.SaveChangesAsync();
 }
 public async Task CreateUserAsync(ChiefUser chiefUser)
 {
     _db.ChiefUsers.Add(chiefUser);
     await _db.SaveChangesAsync();
 }
Example #7
0
 public async Task CreateProjectAsync(Project project)
 {
     _db.Projects.Add(project);
     await _db.SaveChangesAsync();
 }
Example #8
0
 public async Task AddCategoryAsync(Category category)
 {
     _db.Categories.Add(category);
     await _db.SaveChangesAsync();
 }