Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- using System.Web.Mvc;
- using WebApplication1.Models;
- namespace KOSample.Controllers
- {
- public class HomeController : Controller
- {
- public ActionResult Index()
- {
- return View();
- }
- [HttpPost]
- public JsonResult PostDriversModel(DriversModel model)
- {
- return Json(new { Success = true }, JsonRequestBehavior.AllowGet);
- }
- [HttpGet]
- public JsonResult GetDriversModel()
- {
- var model = new DriversModel
- {
- Drivers = new List<Driver>
- {
- new Driver
- {
- Cars = new List<Car>
- {
- new Car {Code = "car0", Name = "Amazing car"},
- new Car {Code = "car1", Name = "Cool car"}
- },
- FullName = "John Doe"
- },
- new Driver
- {
- Cars = new List<Car>
- {
- new Car {Code = "car2", Name = "Another Amazing car"},
- new Car {Code = "car3", Name = "Another Cool car"}
- },
- FullName = "Johnny Dough"
- },
- }
- };
- return Json(model, JsonRequestBehavior.AllowGet);
- }
- }
- }
Add Comment
Please, Sign In to add comment