comparison Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs @ 82:c8897b1c6f49

Manejo de excepciones en sitio web
author nelopauselli
date Tue, 24 May 2011 19:31:10 -0300
parents 2adf55ea9199
children 24e9488ac152
comparison
equal deleted inserted replaced
81:c76661cff260 82:c8897b1c6f49
47 [Authorize] 47 [Authorize]
48 public ActionResult Edit(string id) 48 public ActionResult Edit(string id)
49 { 49 {
50 var agenda = AgendaFactory.GetAgenda(); 50 var agenda = AgendaFactory.GetAgenda();
51 var evento = agenda.GetEvento(new Guid(id)); 51 var evento = agenda.GetEvento(new Guid(id));
52 if (evento!=null) 52
53 { 53 var model = new EventoEditModel
54 var model = new EventoEditModel 54 {
55 { 55 Id = id,
56 Id = id, 56 Titulo = evento.Titulo,
57 Titulo = evento.Titulo, 57 Ponente = evento.Ponente != null ? evento.Ponente.Nombre : string.Empty,
58 Ponente = evento.Ponente != null ? evento.Ponente.Nombre : string.Empty, 58 Fecha = evento.Fecha
59 Fecha = evento.Fecha 59 };
60 }; 60 return View(model);
61 return View(model);
62 }
63 ModelState.AddModelError("error","No se encontrĂ³ el evento que quiere modificar");
64 return View();
65 } 61 }
66 62
67 [HttpPost] 63 [HttpPost]
68 [Authorize] 64 [Authorize]
69 public ActionResult Edit(EventoEditModel model) 65 public ActionResult Edit(EventoEditModel model)
70 { 66 {
71 if (ModelState.IsValid) 67 if (ModelState.IsValid)
72 { 68 {