Newsbot.Collector/Newsbot.Collector.Database/Repositories/UserSourceSubscriptionTable.cs

28 lines
737 B
C#

using Newsbot.Collector.Domain.Entities;
using Newsbot.Collector.Domain.Interfaces;
namespace Newsbot.Collector.Database.Repositories;
public class UserSourceSubscriptionTable : IUserSourceSubscription
{
private DatabaseContext _context;
public UserSourceSubscriptionTable(string connectionString)
{
_context = new DatabaseContext(connectionString);
}
public UserSourceSubscriptionTable(DatabaseContext context)
{
_context = context;
}
public List<UserSourceSubscriptionEntity> ListUserSubscriptions(Guid userId)
{
var results =_context.UserSourceSubscription
.Where(i => i.UserId != null && i.UserId.Equals(userId)).ToList();
return results;
}
}