//
        // GET: /Store/AddToCart/5
        public ActionResult AddToCart(int id)
        {
            // Retrieve the album from the database
            var addedAlbum = _albumAppService.Get(id, @readonly: true);

            // Add it to the shopping cart
            var cart = ShoppingCart.GetCart(HttpContext);

            cart.AddToCart(addedAlbum);

            // Go back to the main store page for more shopping
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public IActionResult Get(long id)
 {
     try
     {
         return(StatusCode(200, App.Get(id)));
     }
     catch (EntityNotFoundException ex)
     {
         return(StatusCode(404, ex.ToString()));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.ToString()));
     }
 }
        //
        // GET: /Store/Details/5

        public ActionResult Details(int id)
        {
            var album = _albumAppService.Get(id, @readonly: true);

            return(View(album));
        }