Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Repositories.NHibernate/PonenteRepository.cs @ 300:48ab8788bd19
#200: Patrocinadores: Agregar link al sitio web.
author | juanjose.montesdeocaarbos |
---|---|
date | Mon, 27 Feb 2012 14:45:12 -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); } } }