18 lines
506 B
C#
18 lines
506 B
C#
|
using System.Linq;
|
|||
|
using NHibernate;
|
|||
|
using Portoa.NHibernate;
|
|||
|
using Portoa.Persistence;
|
|||
|
|
|||
|
namespace VideoGameQuotes.Api.Persistence {
|
|||
|
public interface IUserRepository : IRepository<User> {
|
|||
|
User FindByUsername(string name);
|
|||
|
}
|
|||
|
|
|||
|
public class UserRepository : NHibernateRepository<User>, IUserRepository {
|
|||
|
public UserRepository(ISession session) : base(session) { }
|
|||
|
|
|||
|
public User FindByUsername(string name) {
|
|||
|
return Records.FirstOrDefault(user => user.Username == name);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|