comparison Agendas/trunk/src/Agendas.Repositories.NHibernate/EventoRepository.cs @ 242:5cc1681d3789

Combinar
author juanjose.montesdeocaarbos
date Wed, 05 Oct 2011 07:57:21 -0300
parents 717fce60f200 51faeabfb9d9
children 70c5cab59054
comparison
equal deleted inserted replaced
241:a7daa939ef0c 242:5cc1681d3789
1 using System; 1 using System;
2 using System.Collections.Generic; 2 using System.Collections.Generic;
3 using System.Linq;
3 using AltNetHispano.Agendas.Domain; 4 using AltNetHispano.Agendas.Domain;
4 using AltNetHispano.Agendas.Domain.Repositories; 5 using AltNetHispano.Agendas.Domain.Repositories;
5 using NHibernate; 6 using NHibernate;
7 using NHibernate.Linq;
6 8
7 namespace AltNetHispano.Agendas.Repositories.NHibernate 9 namespace AltNetHispano.Agendas.Repositories.NHibernate
8 { 10 {
9 public class EventoRepository : RepositoryBase<Evento>, IEventoRepository 11 public class EventoRepository : RepositoryBase<Evento>, IEventoRepository
10 { 12 {
47 //No es necesario implementarlo 49 //No es necesario implementarlo
48 } 50 }
49 51
50 public bool ExistePonente(Persona ponente) 52 public bool ExistePonente(Persona ponente)
51 { 53 {
52 return Session.QueryOver<Evento>().Where(ev => ev.Ponente == ponente).RowCount() > 0; 54 return Session.Query<Evento>().Where(ev => ev.Ponentes.Contains(ponente)).Any();
53 } 55 }
54 56
55 public IList<Evento> GetByState(EventoState state) 57 public IList<Evento> GetByState(EventoState state)
56 { 58 {
57 return Session.QueryOver<Evento>().Where(e => e.Estado == state).List(); 59 return Session.QueryOver<Evento>().Where(e => e.Estado == state).List();