コード例 #1
0
        public UnitOfWork Uow = new UnitOfWork(new ApplicationDbContext());// { get; set; }


        //
        // GET: /Product/
        public ActionResult Index()
        {
            var products             = Uow.Products.GetAll();
            var brands               = Uow.Brand.GetAll();
            var partModels           = Uow.PartModel.GetAll();
            ProductsHomeViewModel vm = new ProductsHomeViewModel {
                Products = products.ToList(), Brands = brands.ToList(), PartModels = partModels.ToList()
            };

            return(View(vm));
        }
コード例 #2
0
        public IEnumerable <ProductsHomeViewModel> Get()
        {
            var products             = Uow.Products.GetAll();
            var brands               = Uow.Brand.GetAll();
            var partModels           = Uow.PartModel.GetAll();
            ProductsHomeViewModel vm = new ProductsHomeViewModel {
                Products = products.ToList(), Brands = brands.ToList(), PartModels = partModels.ToList()
            };

            yield return(vm);
        }