コード例 #1
0
        public ActionResult CarOwnerList()
        {
            var list = _ownerInfoService.GetAll();

            ViewBag.OwnerList = list;
            return(View());
        }
コード例 #2
0
        public ActionResult InsertNew()
        {
            var _list     = _vehicleInfoService.GetAll();
            var typeList  = _vehicleTypeService.GetAll();
            var brandList = _brandService.GetAll();
            var ownerList = _ownerInfoService.GetAll();

            ICollection <SelectListItem> dropOwnerList = new List <SelectListItem>
            {
                new SelectListItem {
                    Text  = "请选择车主",
                    Value = "0"
                }
            };

            if (typeList != null)
            {
                foreach (var item in ownerList)
                {
                    dropOwnerList.Add(new SelectListItem
                    {
                        Text  = item.UserName,
                        Value = item.Id.ToString()
                    });
                }
            }


            ICollection <SelectListItem> dropTypeList = new List <SelectListItem>
            {
                new SelectListItem {
                    Text  = "请选择车辆类型",
                    Value = "0"
                }
            };

            if (typeList != null)
            {
                foreach (var item in typeList)
                {
                    dropTypeList.Add(new SelectListItem
                    {
                        Text  = item.VehicleTypeName,
                        Value = item.Id.ToString()
                    });
                }
            }
            ICollection <SelectListItem> dropBrandList = new List <SelectListItem>
            {
                new SelectListItem {
                    Text  = "请选择车辆品牌",
                    Value = "0"
                }
            };

            if (brandList != null)
            {
                foreach (var item in brandList)
                {
                    dropBrandList.Add(new SelectListItem
                    {
                        Text  = item.BrandName,
                        Value = item.Id.ToString()
                    });
                }
            }


            ViewBag.typeList  = dropTypeList;
            ViewBag.brandList = dropBrandList;
            ViewBag.List      = _list;
            ViewBag.ownerList = dropOwnerList;
            //  this.GetVehicleTypeList();

            return(View());
        }