Mercurial > altnet-hispano
comparison 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 |
comparison
equal
deleted
inserted
replaced
161:c1062de96845 | 162:557c386fcecc |
---|---|
75 | 75 |
76 [Authorize] | 76 [Authorize] |
77 public ActionResult Publicar(string id) | 77 public ActionResult Publicar(string id) |
78 { | 78 { |
79 var agenda = AgendaFactory.GetAgenda(); | 79 var agenda = AgendaFactory.GetAgenda(); |
80 agenda.Publicar(new Guid(id), 0, string.Empty); | 80 var evento = agenda.GetEvento(new Guid(id)); |
81 | 81 |
82 this.AddNotification("Evento publicado"); | 82 var model = new EventoPublicarModel |
83 return RedirectToAction("Index"); | 83 { |
84 Id = id, | |
85 Titulo = evento.Titulo, | |
86 NroOrden = 0, //TODO: Obtener el Ășltimo y sumarle uno. | |
87 UrlWiki = evento.UrlWiki, | |
88 DuracionReal = new TimeSpan(0, 0, 0) | |
89 }; | |
90 return View(model); | |
91 } | |
92 | |
93 [HttpPost] | |
94 [Authorize] | |
95 public ActionResult Publicar(EventoPublicarModel model) | |
96 { | |
97 if (ModelState.IsValid) | |
98 { | |
99 var agenda = AgendaFactory.GetAgenda(); | |
100 | |
101 var r = agenda.Publicar(new Guid(model.Id), model.NroOrden, model.UrlWiki); | |
102 if (r.Succeful) | |
103 { | |
104 this.AddNotification(string.Format("Evento publicado {0}", model.Titulo)); | |
105 return RedirectToAction("Index"); | |
106 } | |
107 ModelState.AddModelError("error", r.ToString()); | |
108 } | |
109 return View(model); | |
84 } | 110 } |
85 | 111 |
86 [Authorize] | 112 [Authorize] |
87 public ActionResult Modificar(string id) | 113 public ActionResult Modificar(string id) |
88 { | 114 { |