annotate Agendas/trunk/src/Agendas.Repositories.NHibernate/PatrocinadorRepository.cs @ 275:bf993f99cee3

Ticket #123: Patrocinadores de las vans.
author juanjose.montesdeocaarbos
date Wed, 14 Dec 2011 08:15:44 -0300
parents 72a96459f910
children 6f5ab71614d4
rev   line source
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
1 using System;
275
bf993f99cee3 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 274
diff changeset
2 using System.Collections.Generic;
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
3 using AltNetHispano.Agendas.Domain;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
4 using AltNetHispano.Agendas.Domain.Repositories;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
5 using NHibernate;
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
6
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
7 namespace AltNetHispano.Agendas.Repositories.NHibernate
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
8 {
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
9 public class PatrocinadorRepository : RepositoryBase<Patrocinador>, IPatrocinadorRepository
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
10 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
11 public PatrocinadorRepository(ISessionFactory sessionFactory)
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
12 : base(sessionFactory)
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
13 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
14 }
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
15
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
16 public Patrocinador Get(Guid patrocinadorId)
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
17 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
18 return Session.Get<Patrocinador>(patrocinadorId);
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
19 }
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
20
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
21 public void Delete(Patrocinador patrocinador)
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
22 {
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
23 Session.Delete(patrocinador);
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
24 }
275
bf993f99cee3 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 274
diff changeset
25
bf993f99cee3 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 274
diff changeset
26 public IEnumerable<Patrocinador> GetAll()
bf993f99cee3 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 274
diff changeset
27 {
bf993f99cee3 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 274
diff changeset
28 var patrocinadores = Session.QueryOver<Patrocinador>().List();
bf993f99cee3 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 274
diff changeset
29 ((List<Patrocinador>)patrocinadores).Sort((first, second) => first.Nombre.CompareTo(second.Nombre));
bf993f99cee3 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 274
diff changeset
30
bf993f99cee3 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 274
diff changeset
31 return patrocinadores;
bf993f99cee3 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 274
diff changeset
32 }
274
72a96459f910 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 200
diff changeset
33 }
137
2d1adbaf0373 CRUD de Patrocinador
nelopauselli
parents:
diff changeset
34 }