view Agendas/trunk/src/Agendas.Repositories.NHibernate/PonenteRepository.cs @ 237:51faeabfb9d9

Todos los tests en verde quitando al ponente principal
author nelopauselli
date Tue, 04 Oct 2011 21:30:55 -0300
parents a36a76bd6ec3
children 50442a103281
line wrap: on
line source

using System;
using System.Collections.Generic;
using AltNetHispano.Agendas.Domain;
using AltNetHispano.Agendas.Domain.Repositories;
using NHibernate;

namespace AltNetHispano.Agendas.Repositories.NHibernate
{
	public class PersonaRepository : RepositoryBase<Persona>, IPersonaRepository
	{
		public PersonaRepository(ISessionFactory sessionFactory) : base(sessionFactory)
		{
		}

		public IList<Persona> GetAll()
		{
			return Session.QueryOver<Persona>().List();
		}

		public Persona GetByNombre(string ponenteNombre)
		{
			return Session.QueryOver<Persona>().Where(p => p.Nombre == ponenteNombre).SingleOrDefault();
		}

		public Cuenta GetCuenta(IdentityProviderEnum identityProvider, string username)
		{
			return
				Session.QueryOver<Cuenta>().Where(c => c.IdentityProvider == identityProvider && c.LogonName == username).
					SingleOrDefault();
		}

	    public Persona GetByTwitter(string username)
	    {
	        return Session.QueryOver<Persona>().Where(p => p.Twitter == username).SingleOrDefault();
	    }

	    public void Delete(Persona persona)
	    {
	        Session.Delete(persona);
	    }
	}
}