VideoRepository Creado
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
using CleanArchitecture.Application.Contracts.Persistence;
|
||||||
|
using CleanArchitecture.Domain;
|
||||||
|
using CleanArchitecture.Infrastructure.Persistence;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace CleanArchitecture.Infrastructure.Repositories
|
||||||
|
{
|
||||||
|
internal class VideoRepository : RepositoryBase<Video>, IVideoRepository
|
||||||
|
{
|
||||||
|
|
||||||
|
public VideoRepository(StreamerDbContext context) : base(context) { }
|
||||||
|
|
||||||
|
public async Task<Video> GetVideoByNombre(string nombreVideo)
|
||||||
|
{
|
||||||
|
return await context.Videos.Where(x => x.Nombre!.Equals(nombreVideo)).SingleOrDefaultAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Video>> GetVideoByUserName(string userName)
|
||||||
|
{
|
||||||
|
return await context.Videos.Where(x => x.CreatedBy!.Equals(userName)).ToListAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user