view Agendas/trunk/src/Agendas.Blog/Impl/PostWriter.cs @ 105:1d820f17fc75

ajustes y correcciones en el publicador de blogs agregado de numeroOrden y urlWiki en metodo Publicar de Agenda y Evento (con test)
author jorge.rowies
date Mon, 06 Jun 2011 09:12:52 -0300
parents cc91817a4206
children
line wrap: on
line source

using System.Linq;
using AltNetHispano.Agendas.Domain;

namespace Agendas.Blog.Impl
{
  public abstract class PostWriter : IPostWriter
  {
    private readonly IPostWriterWebService _postWriterWebService;

    protected PostWriter(IPostWriterWebService postWriterWebService)
    {
      _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(Track track);

    protected abstract string GetTitle(Track track);

    protected string GetNombreUsuario(Track track)
    {
      return track.Usuario.Nombre;
    }

    protected void ExecuteService(string title, string body, string author)
    {
      _postWriterWebService.WriteBlogPost(title, body, author, true);
    }


  }
}