コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }