diff Agendas/trunk/src/Agendas.Web/DataProviders.cs @ 285:c8f378272407

#123: Patrocinadores de las vans.
author juanjose.montesdeocaarbos
date Sat, 31 Dec 2011 14:45:55 -0300
parents da9c295e9fa1
children 5f1e3d35e113
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Web/DataProviders.cs	Wed Dec 28 09:35:27 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Web/DataProviders.cs	Sat Dec 31 14:45:55 2011 -0300
@@ -46,5 +46,28 @@
 		{
 			return typeof (DataProviders).Assembly.GetName().Version.ToString();
 		}
+
+		public static IEnumerable<SelectListItem> GetPatrocinadores(this HtmlHelper helper, IEnumerable<Guid> ids)
+		{
+			var repository = AgendaFactory.GetPatrocinadorRepository();
+
+			var patrocinadores = repository.GetAll();
+			if (ids == null || !ids.Any()) return new SelectListItem[] { };
+
+			return from p in patrocinadores
+			       select new SelectListItem {Text = p.Nombre, Value = p.Id.ToString()};
+		}
+
+		public static IEnumerable<SelectListItem> GetPatrocinadoresExcepto(this HtmlHelper helper, IEnumerable<Guid> ids)
+		{
+			var repository = AgendaFactory.GetPatrocinadorRepository();
+
+			var patrocinadores = repository.GetAll();
+			if (ids == null) ids = new List<Guid>();
+
+			return from p in patrocinadores
+				   where !ids.Contains(p.Id)
+				   select new SelectListItem { Text = p.Nombre, Value = p.Id.ToString() };
+		}
 	}
 }