mirror of https://github.com/abpframework/abp.git
committed by
GitHub
8 changed files with 18 additions and 64 deletions
@ -1,13 +0,0 @@ |
|||||
using System; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Domain.Repositories; |
|
||||
|
|
||||
namespace Volo.Blogging.Posts |
|
||||
{ |
|
||||
public interface IPostTagRepository : IBasicRepository<PostTag> |
|
||||
{ |
|
||||
void DeleteOfPost(Guid id); |
|
||||
|
|
||||
Task<PostTag> FindByTagIdAndPostIdAsync(Guid postId, Guid tagId); |
|
||||
} |
|
||||
} |
|
||||
@ -1,28 +0,0 @@ |
|||||
using System; |
|
||||
using System.Linq; |
|
||||
using System.Threading.Tasks; |
|
||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
using Volo.Blogging.EntityFrameworkCore; |
|
||||
|
|
||||
namespace Volo.Blogging.Posts |
|
||||
{ |
|
||||
public class EfCorePostTagRepository : EfCoreRepository<IBloggingDbContext, PostTag>, IPostTagRepository |
|
||||
{ |
|
||||
public EfCorePostTagRepository(IDbContextProvider<IBloggingDbContext> dbContextProvider) : base(dbContextProvider) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public void DeleteOfPost(Guid id) |
|
||||
{ |
|
||||
var recordsToDelete = DbSet.Where(pt=>pt.PostId == id); |
|
||||
DbSet.RemoveRange(recordsToDelete); |
|
||||
} |
|
||||
|
|
||||
public async Task<PostTag> FindByTagIdAndPostIdAsync(Guid postId, Guid tagId) |
|
||||
{ |
|
||||
return await DbSet.FirstOrDefaultAsync(pt=> pt.PostId == postId && pt.TagId == tagId); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue