Skip to content

Instantly share code, notes, and snippets.

@jglozano
Created April 16, 2010 04:26
Show Gist options
  • Save jglozano/368004 to your computer and use it in GitHub Desktop.
Save jglozano/368004 to your computer and use it in GitHub Desktop.
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