# HG changeset patch # User nelo@MTEySS.neluz.int # Date 1300188258 10800 # Node ID e8d2be47a6b00fda64a6ed5a445ffd989eff580a # Parent 41b283d27e3eb605cafc671922812b5a81039445 Cambios de nombre en Portal.Web (Agenda x Evento) diff -r 41b283d27e3e -r e8d2be47a6b0 Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj --- a/Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj Tue Mar 15 07:49:53 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj Tue Mar 15 08:24:18 2011 -0300 @@ -58,7 +58,7 @@ - + Global.asax @@ -128,10 +128,10 @@ - + - + @@ -144,7 +144,7 @@ - + diff -r 41b283d27e3e -r e8d2be47a6b0 Agendas/trunk/src/Agendas.Web/Controllers/AgendaController.cs --- a/Agendas/trunk/src/Agendas.Web/Controllers/AgendaController.cs Tue Mar 15 07:49:53 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -using System; -using System.Linq; -using System.Web.Mvc; -using Agendas.Factories; -using Agendas.Web.Models; -using AltNetHispano.Agendas.Domain.Exceptions; - -namespace Agendas.Web.Controllers -{ - public class AgendaController : Controller - { - public ActionResult Index() - { - var model = GetIndexModel(); - return View(model); - } - - private static AgendaIndexModel GetIndexModel() - { - var agenda = AgendaFactory.GetAgenda(); - - return new AgendaIndexModel - { - ProximosEventos = from e in agenda.GetEventosPublicados() - select new EventoDto {Id = e.Id.ToString(), Titulo = e.Titulo} - }; - } - - [Authorize] - public ActionResult New() - { - return View(); - } - - [HttpPost] - [Authorize] - public ActionResult New(AgendaNewModel model) - { - if (ModelState.IsValid) - { - var agenda = AgendaFactory.GetAgenda(); - - try - { - agenda.Publicar(model.Titulo, model.Ponente, model.Fecha); - - return View("Index", GetIndexModel()); - } - catch (ValidationException ex) - { - ModelState.AddModelError("error", ex.ToString()); - } - } - return View(model); - } - - [Authorize] - public ActionResult Edit(string id) - { - var agenda = AgendaFactory.GetAgenda(); - var evento = agenda.GetEventoPublicado(new Guid(id)); - if (evento!=null) - { - var model = new AgendaEditModel - { - Id = id, - Titulo = evento.Titulo, - Ponente = evento.Ponente != null ? evento.Ponente.Nombre : string.Empty, - Fecha = evento.Fecha - }; - return View(model); - } - ModelState.AddModelError("error","No se encontró el evento que quiere modificar"); - return View(); - } - - [HttpPost] - [Authorize] - public ActionResult Edit(AgendaEditModel model) - { - if (ModelState.IsValid) - { - var agenda = AgendaFactory.GetAgenda(); - - try - { - agenda.ModificarEvento(new Guid(model.Id), model.Titulo, model.Ponente, model.Fecha); - - return View("Index", GetIndexModel()); - } - catch (ValidationException ex) - { - ModelState.AddModelError("error", ex.ToString()); - } - } - return View(model); - } - } -} diff -r 41b283d27e3e -r e8d2be47a6b0 Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs Tue Mar 15 08:24:18 2011 -0300 @@ -0,0 +1,99 @@ +using System; +using System.Linq; +using System.Web.Mvc; +using Agendas.Factories; +using Agendas.Web.Models; +using AltNetHispano.Agendas.Domain.Exceptions; + +namespace Agendas.Web.Controllers +{ + public class EventoController : Controller + { + public ActionResult Index() + { + var model = GetIndexModel(); + return View(model); + } + + private static EventoIndexModel GetIndexModel() + { + var agenda = AgendaFactory.GetAgenda(); + + return new EventoIndexModel + { + ProximosEventos = from e in agenda.GetEventosPublicados() + select new EventoDto {Id = e.Id.ToString(), Titulo = e.Titulo} + }; + } + + [Authorize] + public ActionResult New() + { + return View(); + } + + [HttpPost] + [Authorize] + public ActionResult New(EventoNewModel model) + { + if (ModelState.IsValid) + { + var agenda = AgendaFactory.GetAgenda(); + + try + { + agenda.Publicar(model.Titulo, model.Ponente, model.Fecha); + + return View("Index", GetIndexModel()); + } + catch (ValidationException ex) + { + ModelState.AddModelError("error", ex.ToString()); + } + } + return View(model); + } + + [Authorize] + public ActionResult Edit(string id) + { + var agenda = AgendaFactory.GetAgenda(); + var evento = agenda.GetEventoPublicado(new Guid(id)); + if (evento!=null) + { + var model = new EventoEditModel + { + Id = id, + Titulo = evento.Titulo, + Ponente = evento.Ponente != null ? evento.Ponente.Nombre : string.Empty, + Fecha = evento.Fecha + }; + return View(model); + } + ModelState.AddModelError("error","No se encontró el evento que quiere modificar"); + return View(); + } + + [HttpPost] + [Authorize] + public ActionResult Edit(EventoEditModel model) + { + if (ModelState.IsValid) + { + var agenda = AgendaFactory.GetAgenda(); + + try + { + agenda.ModificarEvento(new Guid(model.Id), model.Titulo, model.Ponente, model.Fecha); + + return View("Index", GetIndexModel()); + } + catch (ValidationException ex) + { + ModelState.AddModelError("error", ex.ToString()); + } + } + return View(model); + } + } +} diff -r 41b283d27e3e -r e8d2be47a6b0 Agendas/trunk/src/Agendas.Web/Models/AgendaModel.cs --- a/Agendas/trunk/src/Agendas.Web/Models/AgendaModel.cs Tue Mar 15 07:49:53 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Models/AgendaModel.cs Tue Mar 15 08:24:18 2011 -0300 @@ -5,12 +5,12 @@ namespace Agendas.Web.Models { - public class AgendaIndexModel + public class EventoIndexModel { public IEnumerable ProximosEventos { get; set; } } - public class AgendaNewModel + public class EventoNewModel { [Required(ErrorMessage = "debe ingresar el título")] public string Titulo { get; set; } @@ -22,7 +22,7 @@ public DateTime Fecha { get; set; } } - public class AgendaEditModel + public class EventoEditModel { [HiddenInput(DisplayValue = false)] public string Id { get; set; } diff -r 41b283d27e3e -r e8d2be47a6b0 Agendas/trunk/src/Agendas.Web/Views/Agenda/Edit.cshtml --- a/Agendas/trunk/src/Agendas.Web/Views/Agenda/Edit.cshtml Tue Mar 15 07:49:53 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -@model Agendas.Web.Models.AgendaEditModel -@{ - ViewBag.Title = "Agenda"; -} - -

- Modifique los datos que desea corregir y presione guardar -

- - - - - - - - - -@using (Html.BeginForm()) -{ - @Html.ValidationSummary(true, "Los datos ingresados no son validos, por favor verifíquelos") -
-
- Datos del evento: - @Html.EditorForModel() -

- -

-
-
-} \ No newline at end of file diff -r 41b283d27e3e -r e8d2be47a6b0 Agendas/trunk/src/Agendas.Web/Views/Agenda/Index.cshtml --- a/Agendas/trunk/src/Agendas.Web/Views/Agenda/Index.cshtml Tue Mar 15 07:49:53 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -@model Agendas.Web.Models.AgendaIndexModel -@{ - ViewBag.Title = "Agenda"; -} - -

- Los próximos eventos son: -

- - - - - - - - - @foreach (var item in Model.ProximosEventos) - { - - - - - } - -
EventoAcciones
@item.Titulo@Html.ActionLink("Modificar", "Edit", new { id = item.Id })
- -

-@Html.ActionLink("Nuevo", "New") -

diff -r 41b283d27e3e -r e8d2be47a6b0 Agendas/trunk/src/Agendas.Web/Views/Agenda/New.cshtml --- a/Agendas/trunk/src/Agendas.Web/Views/Agenda/New.cshtml Tue Mar 15 07:49:53 2011 -0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -@model Agendas.Web.Models.AgendaNewModel -@{ - ViewBag.Title = "Agenda"; -} - -

- Complete los siguiente datos para agendar un nuevo evento -

- - - - - - - - - -@using (Html.BeginForm()) -{ - @Html.ValidationSummary(true, "Los datos ingresados no son validos, por favor verifíquelos") -
-
- Datos del evento: - @Html.EditorForModel() -

- -

-
-
-} \ No newline at end of file diff -r 41b283d27e3e -r e8d2be47a6b0 Agendas/trunk/src/Agendas.Web/Views/Evento/Edit.cshtml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Web/Views/Evento/Edit.cshtml Tue Mar 15 08:24:18 2011 -0300 @@ -0,0 +1,34 @@ +@model Agendas.Web.Models.EventoEditModel +@{ + ViewBag.Title = "Agenda"; +} + +

+ Modifique los datos que desea corregir y presione guardar +

+ + + + + + + + + +@using (Html.BeginForm()) +{ + @Html.ValidationSummary(true, "Los datos ingresados no son validos, por favor verifíquelos") +
+
+ Datos del evento: + @Html.EditorForModel() +

+ +

+
+
+} \ No newline at end of file diff -r 41b283d27e3e -r e8d2be47a6b0 Agendas/trunk/src/Agendas.Web/Views/Evento/Index.cshtml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Web/Views/Evento/Index.cshtml Tue Mar 15 08:24:18 2011 -0300 @@ -0,0 +1,29 @@ +@model Agendas.Web.Models.EventoIndexModel +@{ + ViewBag.Title = "Agenda"; +} + +

+ Los próximos eventos son: +

+ + + + + + + + + @foreach (var item in Model.ProximosEventos) + { + + + + + } + +
EventoAcciones
@item.Titulo@Html.ActionLink("Modificar", "Edit", new { id = item.Id })
+ +

+@Html.ActionLink("Nuevo", "New") +

diff -r 41b283d27e3e -r e8d2be47a6b0 Agendas/trunk/src/Agendas.Web/Views/Evento/New.cshtml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Web/Views/Evento/New.cshtml Tue Mar 15 08:24:18 2011 -0300 @@ -0,0 +1,34 @@ +@model Agendas.Web.Models.EventoNewModel +@{ + ViewBag.Title = "Agenda"; +} + +

+ Complete los siguiente datos para agendar un nuevo evento +

+ + + + + + + + + +@using (Html.BeginForm()) +{ + @Html.ValidationSummary(true, "Los datos ingresados no son validos, por favor verifíquelos") +
+
+ Datos del evento: + @Html.EditorForModel() +

+ +

+
+
+} \ No newline at end of file diff -r 41b283d27e3e -r e8d2be47a6b0 Agendas/trunk/src/Agendas.Web/Views/Shared/_Layout.cshtml --- a/Agendas/trunk/src/Agendas.Web/Views/Shared/_Layout.cshtml Tue Mar 15 07:49:53 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Views/Shared/_Layout.cshtml Tue Mar 15 08:24:18 2011 -0300 @@ -21,7 +21,7 @@