// GET: Inventory
        public ActionResult Index()
        {
            CurrentUser = UserManager.FindById(System.Web.HttpContext.Current.User.Identity.GetUserId());
            IEnumerable <StoredProduct> storedProducts = _storedProductRepository.GetEntities().Where(p => p.UserId == CurrentUser.Id);

            return(View(storedProducts.ToList()));
        }
        public ActionResult Create()
        {
            ProductViewModel model = new ProductViewModel()
            {
                Categories = _categoryRepository.GetEntities().ToList()
            };

            return(View(model));
        }
예제 #3
0
        // GET: Cart
        public ActionResult Index()
        {
            CurrentUser = UserManager.FindById(System.Web.HttpContext.Current.User.Identity.GetUserId());
            List <OrderProduct> orderedProducts = _orderProductRepository.GetEntities().Where(p => p.UserId == this.CurrentUser.Id).ToList();
            CartViewModel       model           = new CartViewModel()
            {
                OrderProducts = orderedProducts,
                Price         = BalanceOperations.GetPrice(orderedProducts)
            };

            return(View(model));
        }
        // GET: Product
        public ActionResult Index()
        {
            ProductIndexViewModel productIndexViewModel = new ProductIndexViewModel()
            {
                Products = _productRepository.GetEntities(),
                IsAdmin  = User.IsInRole("Admin") //bool: IsAdmin = false if current user is not an Admin
            };

            return(View(productIndexViewModel));
        }