public static SelectList TypeSelectList(ItSmartContext db) { var typedat = db.types.ToList(); List <Typeselect> tpList = new List <Typeselect>(); foreach (var item in typedat) { Typeselect tp = new Typeselect(); tp.t_id = item.t_id; tp.t_name = item.t_id + " - " + item.t_name; tpList.Add(tp); } SelectList ls = new SelectList(tpList, "t_id", "t_name"); return(ls); }
public static SelectList brandSelectList(ItSmartContext db) { List <Brandselect> brandList = new List <Brandselect>(); var bdat = db.brands.ToList(); foreach (var item in bdat) { Brandselect bl = new Brandselect(); bl.b_id = item.br_id; bl.b_name = item.br_id + " - " + item.br_name; brandList.Add(bl); } SelectList blselect = new SelectList(brandList, "b_id", "b_name"); return(blselect); }
public static SelectList emSelectList(ItSmartContext db) { var emdat = db.employees.ToList(); List <Emselect> emselects = new List <Emselect>(); foreach (var item in emdat) { Emselect e = new Emselect(); e.em_id = item.em_id; e.em_name = item.em_id + " - " + item.em_name + " - " + item.em_lastname; emselects.Add(e); } SelectList selectListItems = new SelectList(emselects, "em_id", "em_name"); return(selectListItems); }