コード例 #1
0
        public ActionResult Create()
        {
            var viewModel = new AdvertisementViewModel();

            viewModel.Manufacturers = _sqlDbService.GetAllManufactures().ToList();

            var allFeatures       = _sqlDbService.GetAllFeatures().ToList();
            var checkBoxListItems = new List <CheckBoxListItem>();

            foreach (var feature in allFeatures)
            {
                checkBoxListItems.Add(new CheckBoxListItem()
                {
                    Id        = feature.Id,
                    Display   = feature.Name,
                    IsChecked = false
                });
            }
            viewModel.Features = checkBoxListItems;
            return(View("Form", viewModel));
        }
コード例 #2
0
        // GET: Manufacturer
        public ActionResult Index()
        {
            var features = _sqlDbService.GetAllFeatures().ToList();

            return(View(features));
        }