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)); }
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 })); } }
public JsonResult GetById(int id) { var product = _repository.GetProductById(id); return(Json(product)); }