Mercurial > altnet-hispano
diff Agendas/trunk/src/Agendas.Repositories.NHibernate/EventoRepository.cs @ 63:963b71ea6028
Repositorios con NH
author | nelopauselli |
---|---|
date | Tue, 17 May 2011 14:02:25 -0300 |
parents | |
children | b74734a1a755 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Repositories.NHibernate/EventoRepository.cs Tue May 17 14:02:25 2011 -0300 @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using AltNetHispano.Agendas.Domain; +using AltNetHispano.Agendas.Domain.Repositories; +using NHibernate; + +namespace AltNetHispano.Agendas.Repositories.NHibernate +{ + public class EventoRepository : RepositoryBase<Evento>, IEventoRepository + { + public EventoRepository(ISessionFactory sessionFactory) : base(sessionFactory) + { + } + + public void Delete(Evento evento) + { + Session.Delete(evento); + } + + public Evento Get(Guid vanId) + { + return Session.Get<Evento>(vanId); + } + + public IList<Evento> GetEventosConFecha() + { + return Session.QueryOver<Evento>().Where(e => e.Fecha != null).List(); + } + + public IList<Evento> GetEventosSinFecha() + { + return Session.QueryOver<Evento>().Where(e => e.Fecha == null).List(); + } + + public Evento GetPropuestaByTitulo(string titulo) + { + return Session.QueryOver<Evento>().Where(e => e.Titulo==titulo).SingleOrDefault(); + } + + public void Update(Evento evento) + { + //No es necesario implementarlo + } + } +}