Example #1
0
        public RedirectToRouteResult AddToCart(CartService cart, int id)
        {
            var item = service.GetSportSupplement(id);
            SportSupplementDTO data = new SportSupplementDTO
            {
                SportSupplementId = item.SportSupplementId,
                CategoryName      = item.CategoryName,
                Date        = item.Date,
                Description = item.Description,
                Name        = item.Name,
                Price       = item.Price
            };

            if (data == null)
            {
                throw new ValidationException("Don`t found datas", "");
            }

            else
            {
                cart.AddItem(data, 1);
            }

            return(RedirectToAction("DisplaySportSuplement", "SportSupplement"));
        }