comparison Agendas/trunk/src/Agendas.Web/Controllers/PersonaApiController.cs @ 219:b9850b647a4e

Agregando alta de ponente durante la carga del evento
author nelopauselli
date Thu, 08 Sep 2011 11:22:10 -0300
parents
children
comparison
equal deleted inserted replaced
218:cc1ed131c9e6 219:b9850b647a4e
1 using System;
2 using System.Web.Mvc;
3 using AltNetHispano.Agendas.Domain;
4 using AltNetHispano.Agendas.Factories;
5 using AltNetHispano.Agendas.Web.Models;
6
7 namespace AltNetHispano.Agendas.Web.Controllers
8 {
9 public class PersonaApiController : Controller
10 {
11 [CustomAuthorize(Roles = Roles.Administrador)]
12 public PartialViewResult Nueva()
13 {
14 var model = new PersonaNewModel();
15 return PartialView(model);
16 }
17
18 [HttpPost]
19 [CustomAuthorize(Roles = Roles.Administrador)]
20 public JsonResult Nueva(PersonaNewModel model)
21 {
22 if (ModelState.IsValid)
23 {
24 var personas = AgendaFactory.GetPersonaService();
25 var r = personas.Add(model.Nombre, model.Twitter, model.EMail, model.Blog, model.Roles);
26 return Json(r);
27 }
28
29 return Json(new Resultado(false, string.Join(",", ModelState.Values)));
30 }
31 }
32 }