public JsonResult GetPropertyType() { DropDownListsRepository modelRepo = new DropDownListsRepository(); return Json(modelRepo.GetPropertyType().OrderBy(o => o.Name).Select(c => new { ID = c.ID, Name = c.Name }).OrderBy(o => o.Name), JsonRequestBehavior.AllowGet); }
public static SelectList PropertyType(string PropertyTypeID) { DropDownListsRepository modelRepo = new DropDownListsRepository(); var Firms = modelRepo.GetPropertyType(); 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", PropertyTypeID); }