Beispiel #1
0
        // GET: Brand
        public ActionResult Index()
        {
            List <Brand>          brands          = _uow.BrandRepository.GetAll();
            List <BrandViewModel> brandViewModels = BrandViewModel.ToList(brands);

            return(View(brandViewModels));
        }
        private void MakeBrandsViewBag(BrandViewModel brandViewModel = null)
        {
            List <Brand>          brand           = _uow.BrandRepository.GetAll();
            List <BrandViewModel> brandViewModels = BrandViewModel.ToList(brand);

            if (brandViewModel != null)
            {
                ViewBag.Brands = new SelectList(brandViewModels, "ID", "Name", brandViewModel.ID);
            }
            else
            {
                ViewBag.Brands = new SelectList(brandViewModels, "ID", "Name");
            }
        }