Пример #1
0
        public ActionResult Index()
        {
            var goods     = _goodLogic.GetAll();
            var goodViews = _adminHelper.GoodDtoListToGoodAdminViewList(goods);

            return(View(goodViews));
        }
Пример #2
0
        public ActionResult Index()
        {
            ViewBag.Categories = _goodHelper.GetCategories();
            ViewBag.Colors     = _goodHelper.GetColors();

            var goods     = _goodLogic.GetAll();
            var goodViews = Mapper.Map <IEnumerable <GoodDTO>, IEnumerable <GoodViewModel> >(goods);

            return(View(goodViews));
        }
Пример #3
0
        public RedirectToRouteResult AddToCart(Cart cart, int goodId, string returnUrl)
        {
            var good = _goodLogic.GetAll()
                       .FirstOrDefault(g => g.Id == goodId);

            if (good != null)
            {
                cart.AddItem(good, 1);
            }

            return(RedirectToAction("Index", new { returnUrl }));
        }