예제 #1
0
        public IActionResult Index()
        {
            var model = new GuitarBrandViewModel();
            model.Brands = _items;

            return View(model);
        }
예제 #2
0
        public IActionResult Index(GuitarBrandViewModel model)
        {
            model.Brands = _items;
            if (model.SelectedBrandId != 0)
            {
                model.SelectedBrand = (from b in _items
                                       where b.Value == model.SelectedBrandId.ToString()
                                       select new GuitarBrand {
                                           GuitarBrandId = int.Parse(b.Value),
                                           Name = b.Text }).FirstOrDefault();

            }

            return View(model);
        }