コード例 #1
0
        public IActionResult Display(string categoryName, string price, int number)
        {
            //call service
            IQueryable <Product>   list    = _productService.GetQuery();
            IEnumerable <Category> catList = _categoryService.GetAll();

            if (!string.IsNullOrEmpty(categoryName))
            {
                list = list.Where(l => l.Cat.CategoryName == categoryName);
            }
            if (!string.IsNullOrEmpty(price))
            {
                if (price == "max" && number != 0)
                {
                    list = list.Where(l => l.Price <= number);
                }
                else if (price == "min" && number != 0)
                {
                    list = list.Where(l => l.Price >= number);
                }
            }
            //vm
            ProductDisplayViewModel vm = new ProductDisplayViewModel
            {
                Products   = list.ToList(),
                Categories = catList
            };

            //pass to view
            return(View(vm));
        }
コード例 #2
0
        public ActionResult DetailsComingSoon(int id)
        {
            AccountService service  = new AccountService(db, null);
            int            MemberID = 0;

            if (Request.IsAuthenticated)
            {
                MemberID = service.findMember(User.Identity.Name).MemberID;
            }

            ProductInGame pigs = db.ProductInGames.Where(x => x.GameID == id).First();

            if (pigs.Game.GameState.ToLower() == "completed")
            {
                return(Redirect("/"));
            }
            ProductDisplayViewModel pdvm = new ProductDisplayViewModel(MemberID, pigs.GameID);

            pdvm.Product = pigs.Product;
            pdvm.images  = pigs.Product.Imagedetails.Where(w => w.ImageTypeID == 3);


            //TODO: DS: What are therules for which p.i.g. to select/display here
            GameDao gd = new GameDao(db);
            List <GameListViewModel> otherGames = gd.getOtherGames(MemberID, pigs.Game.MemberSubscriptionType);

            otherGames.RemoveAll(g => g.gameID == id);
            pdvm.CurrentProductInGame = pigs;
            pdvm.otherGames           = otherGames;

            return(View(pdvm));
        }
コード例 #3
0
ファイル: Product.cs プロジェクト: wennertorp/OShopen
        public ProductDisplayViewModel ToProductDisplayViewModel()
        {
            ProductDisplayViewModel model = new ProductDisplayViewModel
            {
                ProductId    = ProductId,
                Name         = Name,
                ImageName    = ImageName,
                Price        = Price,
                CategoryName = Category.Name
            };

            return(model);
        }
コード例 #4
0
 public ProductDisplayPage(string barcodeValue)
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     Title = "Product";
     if (Device.RuntimePlatform == Device.iOS)
     {
         Icon = "ProductIcon.png";
     }
     productViewModel = new ProductDisplayViewModel(Navigation, this);
     BindingContext   = productViewModel;
     productViewModel.GetProductInfo(barcodeValue);
 }
コード例 #5
0
        public ActionResult Index()
        {
            //ISitecoreContext context = new SitecoreContext();
            //PModel = context.GetCurrentItem<ProductMapper>();

            //// This was working without IoC
            //IControllerSitecoreContext sitecoreContext = new ContextSitecoreContext();

            var data = new ProductDisplayViewModel
            {
                Product    = _sitecoreContext.GetDataSource <ProductMapper>(),
                Parameters = _sitecoreContext.GetRenderingParameters()
            };

            return(View(data));
        }
コード例 #6
0
 public ShopController(IMapper mapper, IProductRepository repository, ProductDisplayViewModel productDisplayViewModel)
 {
     _mapper     = mapper;
     _repository = repository;
     _productDisplayViewModel = productDisplayViewModel;
 }