|
|
@ -1,4 +1,5 @@ |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Serilog; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
@ -19,16 +20,16 @@ namespace TaskManager.EntityFramework.Repository |
|
|
|
public class Repository<TEntity> : IRepository<TEntity> |
|
|
|
where TEntity : BaseEntity |
|
|
|
{ |
|
|
|
private readonly DbContext _context; |
|
|
|
private readonly JobDbContext _context; |
|
|
|
private readonly DbSet<TEntity> _dbSet; |
|
|
|
|
|
|
|
public Repository(DbContext context) |
|
|
|
public Repository(JobDbContext context) |
|
|
|
{ |
|
|
|
_context = context; |
|
|
|
_dbSet = context.Set<TEntity>(); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<TEntity> GetByIdAsync(int id) |
|
|
|
public async Task<TEntity> GetByIdAsync(long id) |
|
|
|
{ |
|
|
|
return await _dbSet.FindAsync(id); |
|
|
|
} |
|
|
@ -53,7 +54,7 @@ namespace TaskManager.EntityFramework.Repository |
|
|
|
await _context.SaveChangesAsync(); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task DeleteAsync(int id) |
|
|
|
public async Task DeleteAsync(long id) |
|
|
|
{ |
|
|
|
var entity = await _dbSet.FindAsync(id); |
|
|
|
if (entity != null) |
|
|
|