27 lines
731 B
C#
27 lines
731 B
C#
namespace Jambo.Consumer.Infrastructure.DataAccess.Repositories.Posts
|
|
{
|
|
using Jambo.Domain.Model.Posts;
|
|
using MongoDB.Driver;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
public class PostWriteOnlyRepository : IPostWriteOnlyRepository
|
|
{
|
|
private readonly MongoContext _mongoContext;
|
|
public PostWriteOnlyRepository(MongoContext mongoContext)
|
|
{
|
|
_mongoContext = mongoContext;
|
|
}
|
|
|
|
public async Task AddPost(Post post)
|
|
{
|
|
await _mongoContext.Posts.InsertOneAsync(post);
|
|
}
|
|
|
|
public async Task UpdatePost(Post post)
|
|
{
|
|
await _mongoContext.Posts.ReplaceOneAsync(e => e.Id == post.Id, post);
|
|
}
|
|
}
|
|
}
|