Mercurial > altnet-hispano
diff Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs @ 182:beeb48ddb44a
Warning con los errores que se guarden en el log del track de un evento durante una notificación (twitter, calendar, blog)
author | nelopauselli |
---|---|
date | Mon, 08 Aug 2011 21:57:10 -0300 |
parents | 1deccd6c3cb2 |
children | 212c664db5aa |
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs Mon Aug 08 20:08:31 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs Mon Aug 08 21:57:10 2011 -0300 @@ -56,6 +56,8 @@ if (r.Succeful) { this.AddNotification("Evento creado"); + foreach (var log in r.Warnings) + this.AddWarning(log.WarningMessage); return RedirectToAction("Index"); } ModelState.AddModelError("error", r.ToString()); @@ -70,7 +72,11 @@ var r = agenda.Confirmar(new Guid(id)); if (r.Succeful) + { this.AddNotification("Evento confirmado"); + foreach (var log in r.Warnings) + this.AddWarning(log.WarningMessage); + } else this.AddError("Evento confirmado"); @@ -106,6 +112,8 @@ if (r.Succeful) { this.AddNotification(string.Format("Evento publicado {0}", model.Titulo)); + foreach (var log in r.Warnings) + this.AddWarning(log.WarningMessage); return RedirectToAction("Index"); } ModelState.AddModelError("error", r.ToString()); @@ -142,6 +150,8 @@ if (r.Succeful) { this.AddNotification("evento modificado"); + foreach (var log in r.Warnings) + this.AddWarning(log.WarningMessage); return RedirectToAction("Index"); } ModelState.AddModelError("error", r.ToString()); @@ -178,6 +188,8 @@ if (r.Succeful) { this.AddNotification("evento agendado"); + foreach (var log in r.Warnings) + this.AddWarning(log.WarningMessage); return RedirectToAction("Index"); } ModelState.AddModelError("error", r.ToString()); @@ -206,6 +218,8 @@ if (r.Succeful) { this.AddNotification("Evento propuesto"); + foreach (var log in r.Warnings) + this.AddWarning(log.WarningMessage); return RedirectToAction("Index"); } ModelState.AddModelError("error", r.ToString()); @@ -217,19 +231,32 @@ public ActionResult Cancelar(string id) { var agenda = AgendaFactory.GetAgenda(); - agenda.Cancelar(new Guid(id)); + var r = agenda.Cancelar(new Guid(id)); - this.AddNotification("Evento cancelado"); - return RedirectToAction("Index"); + if (r.Succeful) + { + this.AddNotification("Evento cancelado"); + foreach (var log in r.Warnings) + this.AddWarning(log.WarningMessage); + } + else + this.AddError(r.Message); + return RedirectToAction("Index"); } [CustomAuthorize(Roles = Roles.Administrador)] public ActionResult Descartar(string id) { var agenda = AgendaFactory.GetAgenda(); - agenda.Descartar(new Guid(id)); + var r = agenda.Descartar(new Guid(id)); - this.AddNotification("Evento descartado"); + if (r.Succeful) + {this.AddNotification("Evento descartado"); + foreach (var log in r.Warnings) + this.AddWarning(log.WarningMessage); + } + else + this.AddError(r.Message); return RedirectToAction("Index"); } @@ -237,9 +264,16 @@ public ActionResult ReAgendar(string id) { var agenda = AgendaFactory.GetAgenda(); - agenda.ReAgendar(new Guid(id)); + var r = agenda.ReAgendar(new Guid(id)); - this.AddNotification("Evento re-agendado"); + if (r.Succeful) + {this.AddNotification("Evento re-agendado"); + foreach (var log in r.Warnings) + this.AddWarning(log.WarningMessage); + } + else + this.AddError(r.Message); + return RedirectToAction("Index"); } @@ -247,9 +281,16 @@ public ActionResult ReProponer(string id) { var agenda = AgendaFactory.GetAgenda(); - agenda.ReProponer(new Guid(id)); + var r = agenda.ReProponer(new Guid(id)); - this.AddNotification("Evento re-propuesto"); + if (r.Succeful) + { + this.AddNotification("Evento re-propuesto"); + foreach (var log in r.Warnings) + this.AddWarning(log.WarningMessage); + } + else + this.AddError(r.Message); return RedirectToAction("Index"); } }