diff Agendas/trunk/src/Agendas.Domain/Services/PersonaService.cs @ 144:a2b14da4902f

Alta y modificación de ponentes (personas)
author Nelo@Guinea.neluz.int
date Mon, 01 Aug 2011 10:25:23 -0300
parents 2dbb15f4510f
children 5a1f7233aa5a
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Domain/Services/PersonaService.cs	Mon Aug 01 09:41:29 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Domain/Services/PersonaService.cs	Mon Aug 01 10:25:23 2011 -0300
@@ -1,4 +1,6 @@
-using System.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
 using AltNetHispano.Agendas.Domain.Repositories;
 
 namespace AltNetHispano.Agendas.Domain.Services
@@ -56,5 +58,37 @@
 			if (cuenta != null)
 				persona.RemoveCuenta(cuenta);
 		}
+
+	    public IEnumerable<Persona> GetAll()
+	    {
+	        return _personaRepository.GetAll();
+	    }
+
+	    public Persona GetById(Guid id)
+	    {
+	        return _personaRepository.Get(id);
+	    }
+
+        public Resultado Add(string nombre, string twitter, string mail)
+        {
+            var persona = new Persona(nombre) {Twitter = twitter, Mail = mail};
+            _personaRepository.Save(persona);
+
+            return new Resultado(true);
+        }
+
+	    public Resultado Update(Guid id, string nombre, string twitter, string mail)
+	    {
+	        var persona = _personaRepository.Get(id);
+            if (persona == null)
+                return new Resultado(false)
+                           {Message = string.Format("No se pudo encontrar la persona cuyo Id sea {0}", id)};
+
+	        persona.Nombre = nombre;
+	        persona.Twitter = twitter;
+	        persona.Mail = mail;
+
+	        return new Resultado(true);
+	    }
 	}
 }
\ No newline at end of file