Mercurial > altnet-hispano
diff Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs @ 162:557c386fcecc
Ticket 153: UI de Publicar.
author | juanjose.montesdeocaarbos |
---|---|
date | Fri, 05 Aug 2011 22:02:23 -0300 |
parents | 23aaf98b8377 |
children | fae2feae499e |
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs Fri Aug 05 21:54:43 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs Fri Aug 05 22:02:23 2011 -0300 @@ -77,10 +77,36 @@ public ActionResult Publicar(string id) { var agenda = AgendaFactory.GetAgenda(); - agenda.Publicar(new Guid(id), 0, string.Empty); + var evento = agenda.GetEvento(new Guid(id)); + + var model = new EventoPublicarModel + { + Id = id, + Titulo = evento.Titulo, + NroOrden = 0, //TODO: Obtener el Ășltimo y sumarle uno. + UrlWiki = evento.UrlWiki, + DuracionReal = new TimeSpan(0, 0, 0) + }; + return View(model); + } - this.AddNotification("Evento publicado"); - return RedirectToAction("Index"); + [HttpPost] + [Authorize] + public ActionResult Publicar(EventoPublicarModel model) + { + if (ModelState.IsValid) + { + var agenda = AgendaFactory.GetAgenda(); + + var r = agenda.Publicar(new Guid(model.Id), model.NroOrden, model.UrlWiki); + if (r.Succeful) + { + this.AddNotification(string.Format("Evento publicado {0}", model.Titulo)); + return RedirectToAction("Index"); + } + ModelState.AddModelError("error", r.ToString()); + } + return View(model); } [Authorize]