diff Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs @ 116:53bcd338542b

acciones de confirmar y publicar desde la UI
author Nelo@Kenia.neluz.int
date Sun, 19 Jun 2011 13:00:02 -0300
parents 80c22175c9b5
children 7ef7e4bb71f6
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs	Sun Jun 12 01:40:09 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs	Sun Jun 19 13:00:02 2011 -0300
@@ -13,12 +13,20 @@
     {
       var agenda = AgendaFactory.GetAgenda();
 
-      var model = new EventoIndexModel
-      {
-        ProximosEventos = from e in agenda.GetEventosAgendados()
-                          orderby e.Fecha
-                          select new EventoDto { Id = e.Id.ToString(), Titulo = e.Titulo, Fecha = e.Fecha.Value }
-      };
+	  var model = new EventoIndexModel
+	  {
+		  ProximosEventos = from e in agenda.GetEventosAgendados()
+							orderby e.Fecha
+							select new EventoDto
+							{
+								Id = e.Id.ToString(),
+								Titulo = e.Titulo,
+								Fecha = e.Fecha.Value,
+								PuedeModificar = e.GetEstado().PuedePromover(Accion.Modificar),
+								PuedeConfirmar = e.GetEstado().PuedePromover(Accion.Confirmar),
+								PuedePublicar = e.GetEstado().PuedePromover(Accion.Publicar)
+							}
+	  };
 
       return View(model);
     }
@@ -63,6 +71,22 @@
       return View(model);
     }
 
+	[Authorize]
+	public ActionResult Confirm(string id)
+	{
+		var agenda = AgendaFactory.GetAgenda();
+		agenda.Confirmar(new Guid(id));
+		return RedirectToAction("Index");
+	}
+
+	[Authorize]
+	public ActionResult Publish(string id)
+	{
+		var agenda = AgendaFactory.GetAgenda();
+		agenda.Publicar(new Guid(id), 0, string.Empty);
+		return RedirectToAction("Index");
+	}
+
     [HttpPost]
     [Authorize]
     public ActionResult Edit(EventoEditModel model)