コード例 #1
0
        public JsonResult GetPropertyClass()
        {
            DropDownListsRepository modelRepo = new DropDownListsRepository();

             return Json(modelRepo.GetPropertyClass().OrderBy(o => o.Name).Select(c => new { ID = c.ID, Name = c.Name }).OrderBy(o => o.Name), JsonRequestBehavior.AllowGet);
        }
コード例 #2
0
        public static SelectList TypeHotelClass(string TypeHotelClassID)
        {
            DropDownListsRepository modelRepo = new DropDownListsRepository();
            var Firms = modelRepo.GetPropertyClass();

            List<SelectListItem> _Listfirms = new List<SelectListItem>();

                foreach (var item in Firms)
                {
                    SelectListItem itr = new SelectListItem();
                    itr.Text = item.Name;
                    itr.Value = item.ID.ToString();
                    itr.Selected = false;

                    _Listfirms.Add(itr);
                }

            return new SelectList(_Listfirms, "Value", "Text", TypeHotelClassID);
        }