Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Domain/Services/PersonaService.cs @ 259:e6c041d8e1bf
Ticket #193.1: Al guardar (nuevo/modificar) una persona, que la cuenta de twitter no comience con @
author | juanjose.montesdeocaarbos |
---|---|
date | Thu, 20 Oct 2011 08:16:55 -0300 |
parents | b9850b647a4e |
children | dba5d41bc7bf |
comparison
equal
deleted
inserted
replaced
258:52fe43e36f5f | 259:e6c041d8e1bf |
---|---|
81 return _personaRepository.Get(id); | 81 return _personaRepository.Get(id); |
82 } | 82 } |
83 | 83 |
84 public ResultadoAdd 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 if (twitter.StartsWith("@")) | |
87 return new ResultadoAdd("No debe ingresar el arroba al escribir la cuenta de twitter."); | |
88 | |
86 var persona = _personaRepository.GetByNombre(nombre); | 89 var persona = _personaRepository.GetByNombre(nombre); |
87 if (persona!=null) | 90 if (persona!=null) |
88 return new ResultadoAdd("Ya existe una persona con el nombre " + nombre); | 91 return new ResultadoAdd("Ya existe una persona con el nombre " + nombre); |
89 | 92 |
90 persona = _personaRepository.GetByTwitter(twitter); | 93 persona = _personaRepository.GetByTwitter(twitter); |
115 public Resultado Update(Guid id, string nombre, string twitter, string mail, string blog, IEnumerable<string> roles) | 118 public Resultado Update(Guid id, string nombre, string twitter, string mail, string blog, IEnumerable<string> roles) |
116 { | 119 { |
117 var persona = _personaRepository.Get(id); | 120 var persona = _personaRepository.Get(id); |
118 if (persona == null) | 121 if (persona == null) |
119 return new Resultado(false, string.Format("No se pudo encontrar la persona cuyo Id sea {0}", id)); | 122 return new Resultado(false, string.Format("No se pudo encontrar la persona cuyo Id sea {0}", id)); |
123 | |
124 if (twitter.StartsWith("@")) | |
125 return new ResultadoAdd("No debe ingresar el arroba al escribir la cuenta de twitter."); | |
120 | 126 |
121 persona.Nombre = nombre; | 127 persona.Nombre = nombre; |
122 persona.Twitter = twitter; | 128 persona.Twitter = twitter; |
123 persona.Mail = mail; | 129 persona.Mail = mail; |
124 persona.Blog = blog; | 130 persona.Blog = blog; |