public static List <SelectListItem> GetLevel(int?defaultValue) { List <SelectListItem> list = new List <SelectListItem>(); var data = new SalaryRepository().GetSalaryLevel(); foreach (var item in data) { SelectListItem select = new SelectListItem(); select.Value = item.Level.ToString(); select.Text = item.Level.ToString(); list.Add(select); } return(list); }
public static List <SelectListItem> GetSalaryStep(decimal?defaultValue, int?level) { List <SelectListItem> list = new List <SelectListItem>(); var data = new SalaryRepository().GetSalaryStep(level); foreach (var item in data) { SelectListItem select = new SelectListItem(); select.Value = item.Step.ToString(); select.Text = item.Step.ToString(); select.Selected = defaultValue.HasValue ? (item.Step == defaultValue ? true : false) : false; list.Add(select); } return(list); }