view Agendas/trunk/src/Agendas.Web/IdentityHelper.cs @ 186:71737419a839

Ticket 143: Test de unidad, y algo de configuración para acortar URL con servicio de Google.
author juanjose.montesdeocaarbos
date Tue, 09 Aug 2011 08:43:25 -0300
parents 1eb5a0e531bf
children
line wrap: on
line source

using System.Web;
using System.Web.Mvc;
using AltNetHispano.Agendas.Domain;

namespace AltNetHispano.Agendas.Web
{
	public static class IdentityHelper
	{
		public static string DisplayName(this HtmlHelper<dynamic> helper)
		{
			var personaRepository = Factories.AgendaFactory.GetPersonaRepository();
			
			var identification = new Identification(HttpContext.Current.User.Identity.Name);

			var c = personaRepository.GetCuenta(identification.IdentityProvider, identification.LogonName);
			return c == null ? identification.LogonName : c.Persona != null ? c.Persona.Nombre : c.LogonName;
		}
	}
}