示例#1
0
        public ActionResult LoadCountriesList()
        {
            var model = new CascadingDropdownViewModel();

            model = model.LoadModel();

            _countries = model.AllCountries;

            if (HttpContext.Request.IsAjaxRequest())
            {
                return(Json(new SelectList(
                                _countries,
                                "Id",
                                "Description"), JsonRequestBehavior.AllowGet
                            ));
            }
            return(null);
        }
示例#2
0
        public ActionResult LoadTownList(int id)
        {
            var model = new CascadingDropdownViewModel();

            model = model.LoadModel();

            _towns = model.AllTowns.Where(x => x.StateId == id).ToList();

            if (HttpContext.Request.IsAjaxRequest())
            {
                return(Json(new SelectList(
                                _towns,
                                "Id",
                                "Description"), JsonRequestBehavior.AllowGet
                            ));
            }

            return(null);
        }
示例#3
0
        public ActionResult Index()
        {
            var model = new CascadingDropdownViewModel();

            return(View(model.LoadModel()));
        }