Created
April 16, 2010 04:26
-
-
Save jglozano/368004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace JSONMvcSample.Models { | |
using System; | |
[Serializable] | |
public class PersonInputModel { | |
public string Name { get; set; } | |
public int Age { get; set; } | |
} | |
} | |
namespace JSONMvcSample.Controllers { | |
using System.Web.Mvc; | |
using Models; | |
[HandleError] | |
public class HomeController : Controller { | |
public ActionResult Index() { | |
return View(); | |
} | |
[HttpPost] | |
public ActionResult Save(PersonInputModel inputModel) { | |
string message = string.Format("Created user '{0}' in the system.", inputModel.Name); | |
return Json(new PersonViewModel {Message = message}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment