annotate Agendas/trunk/src/Agendas.Repositories.Memory/EventoRepository.cs @ 17:9a07d3091a40

Test sobre la modificación de un evento
author nelo@MTEySS.neluz.int
date Mon, 14 Mar 2011 00:25:34 -0300
parents 08b9e96132a5
children 41b283d27e3e
rev   line source
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
1 using System;
15
08b9e96132a5 Persistimos los eventos de la agenda
nelo@MTEySS.neluz.int
parents: 12
diff changeset
2 using System.Collections.Generic;
08b9e96132a5 Persistimos los eventos de la agenda
nelo@MTEySS.neluz.int
parents: 12
diff changeset
3 using System.Linq;
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
4 using AltNetHispano.Agendas.Domain;
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 4
diff changeset
5 using AltNetHispano.Agendas.Domain.Repositories;
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
6
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
7 namespace Agendas.Repositories.Memory
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
8 {
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 4
diff changeset
9 public class EventoRepository : RepositoryBase<Evento>, IEventoRepository
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
10 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
11 public void Save(Evento evento)
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
12 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
13 if (Guid.Empty.Equals(evento.Id))
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
14 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
15 evento.Id = Guid.NewGuid();
4
49b572535156 proponer van
nelopauselli
parents: 2
diff changeset
16 Objects.Add(evento.Id, evento);
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
17 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
18 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
19
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
20 public void Update(Evento evento)
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
21 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
22 //nada que hacer en este método para este repositorio
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
23 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
24
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
25 public void Delete(Evento evento)
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
26 {
4
49b572535156 proponer van
nelopauselli
parents: 2
diff changeset
27 Objects.Remove(evento.Id);
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
28 }
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 4
diff changeset
29
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 4
diff changeset
30 public Evento Get(Guid vanId)
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 4
diff changeset
31 {
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 4
diff changeset
32 Evento evento;
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 4
diff changeset
33 return Objects.TryGetValue(vanId, out evento) ? evento : null;
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 4
diff changeset
34 }
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 4
diff changeset
35
15
08b9e96132a5 Persistimos los eventos de la agenda
nelo@MTEySS.neluz.int
parents: 12
diff changeset
36 public IList<Evento> GetEventosSinFecha()
08b9e96132a5 Persistimos los eventos de la agenda
nelo@MTEySS.neluz.int
parents: 12
diff changeset
37 {
08b9e96132a5 Persistimos los eventos de la agenda
nelo@MTEySS.neluz.int
parents: 12
diff changeset
38 return Objects.Values.Where(e => e.Fecha == null).ToList();
08b9e96132a5 Persistimos los eventos de la agenda
nelo@MTEySS.neluz.int
parents: 12
diff changeset
39 }
08b9e96132a5 Persistimos los eventos de la agenda
nelo@MTEySS.neluz.int
parents: 12
diff changeset
40
08b9e96132a5 Persistimos los eventos de la agenda
nelo@MTEySS.neluz.int
parents: 12
diff changeset
41 public IList<Evento> GetEventosConFecha()
08b9e96132a5 Persistimos los eventos de la agenda
nelo@MTEySS.neluz.int
parents: 12
diff changeset
42 {
08b9e96132a5 Persistimos los eventos de la agenda
nelo@MTEySS.neluz.int
parents: 12
diff changeset
43 return Objects.Values.Where(e => e.Fecha != null).ToList();
08b9e96132a5 Persistimos los eventos de la agenda
nelo@MTEySS.neluz.int
parents: 12
diff changeset
44 }
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
45 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
46 }