public static IEnumerable <SelectListItem> CountryDropList(string selectedCountryCode = "") { var context = new Alphareds.Module.Model.Database.MayFlower(); return(from a in context.Countries where a.IsActive == true orderby a.Country1 select new SelectListItem { Text = a.Country1, Value = a.CountryCode, Selected = a.CountryCode == selectedCountryCode }); }
public static IEnumerable <SelectListItem> PhoneCodeList(string selectedPhoneCountryCode = "") { var context = new Alphareds.Module.Model.Database.MayFlower(); return((from a in context.Countries where a.IsActive == true && a.PhoneCode != "0" && a.PhoneCode != null //orderby a.Country1 //orderby a.PhoneCodeDisplay.Length, a.PhoneCodeDisplay ascending select new SelectListItem { Text = a.Country1 + " (" + a.PhoneCodeDisplay + ")", Value = a.CountryCode, Selected = a.CountryCode == selectedPhoneCountryCode, }).Distinct().OrderBy(a => a.Text)); }