Exemplo n.º 1
0
        public CartViewModel GetCart()
        {
            var session   = new SessionManager(_httpContextAccessor.HttpContext);
            var cartItems = session.GetCart();
            var services  = _blService.Get(cartItems);

            return(new CartViewModel
            {
                SelectedServices = services.ToList(),
                TotalPrice = services.Sum(x => x.TotalPrice)
            });
        }
Exemplo n.º 2
0
        public ServiceDetailsViewModel GetServiceDetailsModel(int id)
        {
            var service = _blService.Get(id);
            var session = new SessionManager(_httpContextAccessor.HttpContext);
            var cart    = session.GetCart();

            return(new ServiceDetailsViewModel()
            {
                Service = service,
                IsInCart = cart.Contains(service.ServiceModel.Id)
            });
        }