Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Blog/Impl/PostWriter.cs @ 109:6bd9be78caa0
Merge
author | Nelo@Kenia.neluz.int |
---|---|
date | Tue, 07 Jun 2011 23:21:07 -0300 |
parents | 1d820f17fc75 |
children |
comparison
equal
deleted
inserted
replaced
108:786a90e26c9b | 109:6bd9be78caa0 |
---|---|
1 using System; | 1 using System.Linq; |
2 using System.Linq; | |
3 using AltNetHispano.Agendas.Domain; | 2 using AltNetHispano.Agendas.Domain; |
4 | 3 |
5 namespace Agendas.Blog.Impl | 4 namespace Agendas.Blog.Impl |
6 { | 5 { |
7 public abstract class PostWriter : IPostWriter | 6 public abstract class PostWriter : IPostWriter |
8 { | 7 { |
9 public virtual void WritePost(Evento evento) | 8 private readonly IPostWriterWebService _postWriterWebService; |
9 | |
10 protected PostWriter(IPostWriterWebService postWriterWebService) | |
10 { | 11 { |
11 var title = GetTitle(evento); | 12 _postWriterWebService = postWriterWebService; |
12 var body = GetBody(evento); | |
13 this.ExecuteService(title, body); | |
14 } | 13 } |
15 | 14 |
16 protected abstract string GetBody(Evento evento); | 15 public virtual void WritePost(Track track) |
17 | |
18 protected abstract string GetTitle(Evento evento); | |
19 | |
20 protected string GetNombreUsuario(Evento evento) | |
21 { | 16 { |
22 return evento.Tracks.Single(t => t.Accion == Accion.Publicar).Usuario.Nombre; | 17 var title = GetTitle(track); |
18 var body = GetBody(track); | |
19 this.ExecuteService(title, body, this.GetNombreUsuario(track)); | |
23 } | 20 } |
24 | 21 |
25 protected void ExecuteService(string title, string body) | 22 protected abstract string GetBody(Track track); |
23 | |
24 protected abstract string GetTitle(Track track); | |
25 | |
26 protected string GetNombreUsuario(Track track) | |
26 { | 27 { |
27 //TODO: invocar al web service | 28 return track.Usuario.Nombre; |
28 throw new NotImplementedException(); | |
29 } | 29 } |
30 | |
31 protected void ExecuteService(string title, string body, string author) | |
32 { | |
33 _postWriterWebService.WriteBlogPost(title, body, author, true); | |
34 } | |
35 | |
36 | |
30 } | 37 } |
31 } | 38 } |