vgquotes/Src/VideoGameQuotes.Api/Persistence/IUserRepository.cs
tmont 99cb4defbe * login/logout
* change administration password
2011-02-17 20:55:47 +00:00

27 lines
741 B
C#

using System.Linq;
using JetBrains.Annotations;
using NHibernate;
using Portoa.NHibernate;
using Portoa.Persistence;
namespace VideoGameQuotes.Api.Persistence {
public interface IUserRepository : IRepository<User> {
[CanBeNull]
User FindByUsername(string name);
[CanBeNull]
User FindByIpAddress(string ipAddress);
}
public class UserRepository : NHibernateRepository<User>, IUserRepository {
public UserRepository(ISession session) : base(session) { }
public User FindByUsername(string name) {
return Records.FirstOrDefault(user => user.Username == name);
}
public User FindByIpAddress(string ipAddress) {
return Records.FirstOrDefault(user => user.IpAddress == ipAddress);
}
}
}