Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Domain/Services/PersonaService.cs @ 219:b9850b647a4e
Agregando alta de ponente durante la carga del evento
author | nelopauselli |
---|---|
date | Thu, 08 Sep 2011 11:22:10 -0300 |
parents | a36a76bd6ec3 |
children | e6c041d8e1bf |
comparison
equal
deleted
inserted
replaced
218:cc1ed131c9e6 | 219:b9850b647a4e |
---|---|
79 public Persona GetById(Guid id) | 79 public Persona GetById(Guid id) |
80 { | 80 { |
81 return _personaRepository.Get(id); | 81 return _personaRepository.Get(id); |
82 } | 82 } |
83 | 83 |
84 public Resultado Add(string nombre, string twitter, string mail, string blog, IEnumerable<string> roles) | 84 public ResultadoAdd Add(string nombre, string twitter, string mail, string blog, IEnumerable<string> roles) |
85 { | 85 { |
86 var persona = new Persona(nombre) {Twitter = twitter, Mail = mail, Blog = blog}; | 86 var persona = _personaRepository.GetByNombre(nombre); |
87 if (persona!=null) | |
88 return new ResultadoAdd("Ya existe una persona con el nombre " + nombre); | |
89 | |
90 persona = _personaRepository.GetByTwitter(twitter); | |
91 if (persona != null) | |
92 return new ResultadoAdd("Ya existe una persona con el twitter " + twitter); | |
93 | |
94 persona = new Persona(nombre) {Twitter = twitter, Mail = mail, Blog = blog}; | |
87 | 95 |
88 if (!string.IsNullOrWhiteSpace(twitter)) | 96 if (!string.IsNullOrWhiteSpace(twitter)) |
89 persona.AddCuenta(new Cuenta(IdentityProviderEnum.Twitter, twitter)); | 97 persona.AddCuenta(new Cuenta(IdentityProviderEnum.Twitter, twitter)); |
90 | 98 |
91 SetDefaultGroups(persona); | 99 SetDefaultGroups(persona); |
99 } | 107 } |
100 } | 108 } |
101 | 109 |
102 _personaRepository.Save(persona); | 110 _personaRepository.Save(persona); |
103 | 111 |
104 return new Resultado(true, "Persona Agregada"); | 112 return new ResultadoAdd(true, "Persona Agregada", persona.Id, persona.Nombre); |
105 } | 113 } |
106 | 114 |
107 public Resultado Update(Guid id, string nombre, string twitter, string mail, string blog, IEnumerable<string> roles) | 115 public Resultado Update(Guid id, string nombre, string twitter, string mail, string blog, IEnumerable<string> roles) |
108 { | 116 { |
109 var persona = _personaRepository.Get(id); | 117 var persona = _personaRepository.Get(id); |