# HG changeset patch
# User nelo@MTEySS.neluz.int
# Date 1300060155 10800
# Node ID ed6d842abf424292df91a4855978ae4158c4f72a
# Parent da95298db862064c540b25fdd35bf1676512e49c
Modificar evento
diff -r da95298db862 -r ed6d842abf42 Agendas/trunk/src/Agendas.Domain/Agenda.cs
--- a/Agendas/trunk/src/Agendas.Domain/Agenda.cs Sun Mar 13 20:24:20 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Domain/Agenda.cs Sun Mar 13 20:49:15 2011 -0300
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using AltNetHispano.Agendas.Domain.Exceptions;
namespace AltNetHispano.Agendas.Domain
@@ -36,6 +37,9 @@
if (string.IsNullOrWhiteSpace(evento.Ponente))
throw new ValidationException();
+ //TODO: persistir el evento!
+ if (evento.Id==Guid.Empty) evento.Id = Guid.NewGuid();
+
_eventosPublicados.Add(evento);
}
@@ -68,9 +72,28 @@
return seguridad == null || seguridad.GetPrincipal() == null || seguridad.GetPrincipal().Identity == null
|| string.IsNullOrWhiteSpace(seguridad.GetPrincipal().Identity.Name);
}
- }
+
+ public void ModificarEvento(Guid id, string titulo, string ponente, DateTime? fecha)
+ {
+ var evento = _eventosPublicados.SingleOrDefault(e => e.Id == id);
+ if (evento == null)
+ throw new EventoNotFoundException();
+ evento.Titulo = titulo;
+ evento.Ponente = ponente;
+ evento.Fecha = fecha;
+ }
- public class UsuarioNoAutenticadoException : Exception
+ public Evento GetEventoPublicado(Guid id)
+ {
+ return _eventosPublicados.SingleOrDefault(e => e.Id == id);
+ }
+ }
+
+ public class EventoNotFoundException : Exception
+ {
+ }
+
+ public class UsuarioNoAutenticadoException : Exception
{
}
}
\ No newline at end of file
diff -r da95298db862 -r ed6d842abf42 Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj
--- a/Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj Sun Mar 13 20:24:20 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj Sun Mar 13 20:49:15 2011 -0300
@@ -136,6 +136,9 @@
Agendas.Domain
+
+
+