Beispiel #1
0
        public async Task <IActionResult> Details(int?id)
        {
            _logger.Log(_userManager.GetUserId(HttpContext.User), "GetProductDetails");
            if (id == null)
            {
                return(NotFound());
            }

            var product = await _repository.GetProductById(id);

            if (product == null)
            {
                return(NotFound());
            }

            return(View(product));
        }
Beispiel #2
0
        public async Task <IActionResult> AddToBasket(int?id, string orderbyList, string categoryList, string pageNumber, string itemsPerPage)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var product = await _repository.GetProductById(id);

            if (product == null)
            {
                return(NotFound());
            }
            else
            {
                _basketService.AddToBasket(product);
                _logger.Log(_userManager.GetUserId(HttpContext.User), "AddToBasket");
                return(RedirectToAction("Products", "Products", new { orderbyList = orderbyList, categoryList = categoryList, pageNumber = pageNumber, itemsPerPage = itemsPerPage }));
            }
        }
Beispiel #3
0
        public JsonResult GetById(int id)
        {
            var product = _repository.GetProductById(id);

            return(Json(product));
        }