mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-21 01:49:57 +02:00
32 lines
835 B
C#
32 lines
835 B
C#
|
using System;
|
||
|
using System.Linq;
|
||
|
using NzbDrone.Core.Datastore;
|
||
|
using NzbDrone.Core.Messaging.Events;
|
||
|
|
||
|
namespace NzbDrone.Core.Authentication
|
||
|
{
|
||
|
public interface IUserRepository : IBasicRepository<User>
|
||
|
{
|
||
|
User FindUser(string username);
|
||
|
User FindUser(Guid identifier);
|
||
|
}
|
||
|
|
||
|
public class UserRepository : BasicRepository<User>, IUserRepository
|
||
|
{
|
||
|
public UserRepository(IDatabase database, IEventAggregator eventAggregator)
|
||
|
: base(database, eventAggregator)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public User FindUser(string username)
|
||
|
{
|
||
|
return Query.Where(u => u.Username == username).SingleOrDefault();
|
||
|
}
|
||
|
|
||
|
public User FindUser(Guid identifier)
|
||
|
{
|
||
|
return Query.Where(u => u.Identifier == identifier).SingleOrDefault();
|
||
|
}
|
||
|
}
|
||
|
}
|