comparison 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
comparison
equal deleted inserted replaced
115:7a2eeb9e9bf9 116:53bcd338542b
11 { 11 {
12 public ActionResult Index() 12 public ActionResult Index()
13 { 13 {
14 var agenda = AgendaFactory.GetAgenda(); 14 var agenda = AgendaFactory.GetAgenda();
15 15
16 var model = new EventoIndexModel 16 var model = new EventoIndexModel
17 { 17 {
18 ProximosEventos = from e in agenda.GetEventosAgendados() 18 ProximosEventos = from e in agenda.GetEventosAgendados()
19 orderby e.Fecha 19 orderby e.Fecha
20 select new EventoDto { Id = e.Id.ToString(), Titulo = e.Titulo, Fecha = e.Fecha.Value } 20 select new EventoDto
21 }; 21 {
22 Id = e.Id.ToString(),
23 Titulo = e.Titulo,
24 Fecha = e.Fecha.Value,
25 PuedeModificar = e.GetEstado().PuedePromover(Accion.Modificar),
26 PuedeConfirmar = e.GetEstado().PuedePromover(Accion.Confirmar),
27 PuedePublicar = e.GetEstado().PuedePromover(Accion.Publicar)
28 }
29 };
22 30
23 return View(model); 31 return View(model);
24 } 32 }
25 33
26 [Authorize] 34 [Authorize]
61 UrlInvitacion = evento.UrlInvitacion 69 UrlInvitacion = evento.UrlInvitacion
62 }; 70 };
63 return View(model); 71 return View(model);
64 } 72 }
65 73
74 [Authorize]
75 public ActionResult Confirm(string id)
76 {
77 var agenda = AgendaFactory.GetAgenda();
78 agenda.Confirmar(new Guid(id));
79 return RedirectToAction("Index");
80 }
81
82 [Authorize]
83 public ActionResult Publish(string id)
84 {
85 var agenda = AgendaFactory.GetAgenda();
86 agenda.Publicar(new Guid(id), 0, string.Empty);
87 return RedirectToAction("Index");
88 }
89
66 [HttpPost] 90 [HttpPost]
67 [Authorize] 91 [Authorize]
68 public ActionResult Edit(EventoEditModel model) 92 public ActionResult Edit(EventoEditModel model)
69 { 93 {
70 if (ModelState.IsValid) 94 if (ModelState.IsValid)