public IActionResult AddToCart(int Id, string returnUrl) { Book book = _repository.GetElem(Id); int countBooksInStore = _repository.DecCountBook(book); if (book != null) { _cart.AddItem(book); } return(Json(new { bookId = book.Id, bookCountInStore = countBooksInStore, bookTitle = book.Title, countBooksInCart = _cart.ComputeTotalValue() })); }