public async Task <IEnumerable <_CartCatering> > Add([FromBody] int id)
        {
            var catering = await _catering.GetLunchByIdAsync(id);

            _cart.AddCateringToCart(catering, 1);
            return(_cart.GetCartCaterings(null));
        }
        public async Task <IActionResult> AddToCart(int id)
        {
            var catering = await _catering.GetLunchByIdAsync(id);

            _cart.AddCateringToCart(catering, 1);
            return(Ok());
        }
        public async Task <RedirectResult> AddCateringToShoppingCart(int id)
        {
            var catering = await _lunchRep.GetLunchByIdAsync(id);

            if (catering != null)
            {
                _cartRepository.AddCateringToCart(catering, amount: 1);
            }
            return(Redirect("/cart"));
        }
Пример #4
0
        public RedirectToActionResult AddCateringToShoppingCart(int id)
        {
            var catering = _lunchRep.GetLunch(id);

            if (catering != null)
            {
                _cartRepository.AddCateringToCart(catering, amount: 1);
            }
            return(RedirectToAction("Index"));
        }