示例#1
0
        public IndexViewModel Index(IndexSetupViewModel inModel)
        {
            var prod1 = new Product {Name = "TestProduct1", Description = "This is a test product"};

            _repository.Save(prod1);

            var prod2 = new Product {Name = "TestProduct2", Description = "This is a test product"};

            _repository.Save(prod2);

            var outModel = new IndexViewModel();

            var productList = _repository.Query<Product>();

            outModel.Products = productList.ToList().Select(x => new ProductDisplay(x));

            return outModel;
        }
示例#2
0
 public ProductDisplay(Product product)
 {
     Name = product.Name;
     Description = product.Description;
 }