Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Repositories.NHibernate/PonenteRepository.cs @ 278:6f5ab71614d4
#125: ABM de patrocinadores.
author | juanjose.montesdeocaarbos |
---|---|
date | Wed, 21 Dec 2011 08:47:05 -0300 |
parents | 50442a103281 |
children |
line wrap: on
line source
using System; using System.Collections; 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() { var personas = Session.QueryOver<Persona>().List(); ((List<Persona>)personas).Sort((first, second) => first.Nombre.CompareTo(second.Nombre)); return personas; } 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); } } }