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)); }
// GET: Manufacturer public ActionResult Index() { var features = _sqlDbService.GetAllFeatures().ToList(); return(View(features)); }