23 lines
389 B
C#
23 lines
389 B
C#
namespace Diary.Data
|
|
{
|
|
|
|
public interface IUnitOfWork
|
|
{
|
|
Task CompleteAsync();
|
|
}
|
|
|
|
public class UnitOfWork:IUnitOfWork
|
|
{
|
|
private readonly IDiaryDBContext _context;
|
|
|
|
public UnitOfWork(IDiaryDBContext context)
|
|
{
|
|
_context = context ?? throw new ArgumentNullException(nameof(context));
|
|
}
|
|
|
|
public async Task CompleteAsync()
|
|
{
|
|
await _context.SaveChangesAsync();
|
|
}
|
|
}
|
|
} |