﻿using System.Linq;
using NHibernate;
using NHibernate.Criterion;

namespace DeVi.Models.Repositories
{
	internal class PersonRepository : Repository<Person>, IPersonRepository
	{
		public Person GetByName( string name )
		{
			return
				Session.CreateCriteria<Person>()
					.Add( Restrictions.Eq( nameof( Person.Name ), name ) )
					.List<Person>()
					.FirstOrDefault();
		}
	}
}