Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Web/Controllers/PersonaController.cs @ 157:f17252543cbf
Agregando la url del blog a los datos de la persona
author | Nelo@Guinea.neluz.int |
---|---|
date | Thu, 04 Aug 2011 18:45:18 -0300 |
parents | 23aaf98b8377 |
children | 1deccd6c3cb2 |
comparison
equal
deleted
inserted
replaced
156:6e554de521aa | 157:f17252543cbf |
---|---|
27 public ActionResult Nueva(PersonaNewModel model) | 27 public ActionResult Nueva(PersonaNewModel model) |
28 { | 28 { |
29 if (ModelState.IsValid) | 29 if (ModelState.IsValid) |
30 { | 30 { |
31 var personas = AgendaFactory.GetPersonaService(); | 31 var personas = AgendaFactory.GetPersonaService(); |
32 var r = personas.Add(model.Nombre, model.Twitter, model.EMail); | 32 var r = personas.Add(model.Nombre, model.Twitter, model.EMail,model.Blog); |
33 if (r.Succeful) | 33 if (r.Succeful) |
34 { | 34 { |
35 this.AddNotification("Los datos fueron guardados"); | 35 this.AddNotification("Los datos fueron guardados"); |
36 return RedirectToAction("Index"); | 36 return RedirectToAction("Index"); |
37 } | 37 } |
38 else | 38 this.AddError(r.Message); |
39 this.AddError(r.Message); | |
40 } | 39 } |
41 | 40 |
42 return View("Defaulteditor", model); | 41 return View("Defaulteditor", model); |
43 } | 42 } |
44 | 43 |
51 { | 50 { |
52 this.AddError("No se encontrĂ³ la persona que intenta modificar"); | 51 this.AddError("No se encontrĂ³ la persona que intenta modificar"); |
53 return RedirectToAction("Index"); | 52 return RedirectToAction("Index"); |
54 } | 53 } |
55 | 54 |
56 var model = new PersonaEditModel | 55 var model = new PersonaEditModel |
57 {Id = persona.Id.ToString(), Nombre = persona.Nombre, Twitter = persona.Twitter, EMail = persona.Mail}; | 56 { |
57 Id = persona.Id.ToString(), | |
58 Nombre = persona.Nombre, | |
59 Twitter = persona.Twitter, | |
60 EMail = persona.Mail, | |
61 Blog = persona.Blog | |
62 }; | |
58 | 63 |
59 return View("Defaulteditor", model); | 64 return View("Defaulteditor", model); |
60 } | 65 } |
61 | 66 |
62 [HttpPost] | 67 [HttpPost] |
63 public ActionResult Modificar(PersonaEditModel model) | 68 public ActionResult Modificar(PersonaEditModel model) |
64 { | 69 { |
65 if (ModelState.IsValid) | 70 if (ModelState.IsValid) |
66 { | 71 { |
67 var personas = AgendaFactory.GetPersonaService(); | 72 var personas = AgendaFactory.GetPersonaService(); |
68 var r = personas.Update(new Guid(model.Id), model.Nombre, model.Twitter, model.EMail); | 73 var r = personas.Update(new Guid(model.Id), model.Nombre, model.Twitter, model.EMail, model.Blog); |
69 if (r.Succeful) | 74 if (r.Succeful) |
70 { | 75 { |
71 this.AddNotification("Los datos fueron guardados"); | 76 this.AddNotification("Los datos fueron guardados"); |
72 return RedirectToAction("Index"); | 77 return RedirectToAction("Index"); |
73 } | 78 } |
74 else | 79 this.AddError(r.Message); |
75 this.AddError(r.Message); | |
76 } | 80 } |
77 | 81 |
78 return View("Defaulteditor", model); | 82 return View("Defaulteditor", model); |
79 } | 83 } |
80 } | 84 } |