Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Domain/EventoNullState.cs @ 101:9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
author | jorge.rowies |
---|---|
date | Sun, 05 Jun 2011 11:10:32 -0300 |
parents | |
children | 23325dddddcc |
comparison
equal
deleted
inserted
replaced
100:cc91817a4206 | 101:9bfdd5bf3ad2 |
---|---|
1 using AltNetHispano.Agendas.Domain.Exceptions; | |
2 | |
3 namespace AltNetHispano.Agendas.Domain | |
4 { | |
5 public class EventoNullState : EventoState | |
6 { | |
7 private readonly Evento _evento; | |
8 | |
9 public EventoNullState(Evento evento) | |
10 { | |
11 _evento = evento; | |
12 } | |
13 | |
14 public override void Promover(Accion accion) | |
15 { | |
16 switch (accion) | |
17 { | |
18 case Accion.Proponer: | |
19 _evento.Estado = new EventoPropuestoState(_evento); | |
20 break; | |
21 case Accion.Agendar: | |
22 _evento.Estado = new EventoAgendadoState(_evento); | |
23 break; | |
24 default: | |
25 throw new AccionNoSoportadaException(this.GetType(), accion); | |
26 } | |
27 } | |
28 } | |
29 } |