diff 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
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Blog/Impl/PostWriter.cs	Tue Jun 07 23:07:06 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Blog/Impl/PostWriter.cs	Tue Jun 07 23:21:07 2011 -0300
@@ -1,31 +1,38 @@
-using System;
-using System.Linq;
+using System.Linq;
 using AltNetHispano.Agendas.Domain;
 
 namespace Agendas.Blog.Impl
 {
   public abstract class PostWriter : IPostWriter
   {
-    public virtual void WritePost(Evento evento)
+    private readonly IPostWriterWebService _postWriterWebService;
+
+    protected PostWriter(IPostWriterWebService postWriterWebService)
     {
-      var title = GetTitle(evento);
-      var body = GetBody(evento);
-      this.ExecuteService(title, body);
+      _postWriterWebService = postWriterWebService;
+    }
+
+    public virtual void WritePost(Track track)
+    {
+      var title = GetTitle(track);
+      var body = GetBody(track);
+      this.ExecuteService(title, body, this.GetNombreUsuario(track));
     }
 
-    protected abstract string GetBody(Evento evento);
+    protected abstract string GetBody(Track track);
 
-    protected abstract string GetTitle(Evento evento);
+    protected abstract string GetTitle(Track track);
 
-    protected string GetNombreUsuario(Evento evento)
+    protected string GetNombreUsuario(Track track)
     {
-      return evento.Tracks.Single(t => t.Accion == Accion.Publicar).Usuario.Nombre;
+      return track.Usuario.Nombre;
     }
 
-    protected void ExecuteService(string title, string body)
+    protected void ExecuteService(string title, string body, string author)
     {
-      //TODO: invocar al web service
-      throw new NotImplementedException();
+      _postWriterWebService.WriteBlogPost(title, body, author, true);
     }
+
+
   }
 }
\ No newline at end of file