<commit_before>﻿using Nwazet.Commerce.Models;
using Nwazet.Commerce.Services;
using Nwazet.Commerce.ViewModels;
using Orchard;
using Orchard.ContentManagement;
using Orchard.Environment.Extensions;
using Orchard.Themes;
using Orchard.Workflows.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace Nwazet.Commerce.Controllers {
    [OrchardFeature("Nwazet.WishLists")]
    [Themed]
    public class WishListsController : Controller {
        private readonly IWorkContextAccessor _wca;
        private readonly IWishListServices _wishListServices;
        private readonly IContentManager _contentManager;
        private readonly IEnumerable<IProductAttributeExtensionProvider> _attributeExtensionProviders;
        private readonly IShoppingCart _shoppingCart;
        private readonly IWorkflowManager _workflowManager;

        public WishListsController(
            IWorkContextAccessor wca,
            IWishListServices wishListServices,
            IContentManager contentManager,
            IEnumerable<IProductAttributeExtensionProvider> attributeExtensionProviders,
            IShoppingCart shoppingCart,
            IWorkflowManager workflowManager) {

            _wca = wca;
            _wishListServices = wishListServices;
            _contentManager = contentManager;
            _attributeExtensionProviders = attributeExtensionProviders;
            _shoppingCart = shoppingCart;
            _workflowManager = workflowManager;
        }

        private const string AttributePrefix = "productattributes.a";
        private const string ExtensionPrefix = "ext.";

        public ActionResult Index(int id = 0) {
            var user = _wca.GetContext().CurrentUser;
            if (user == null) {
                return new HttpUnauthorizedResult();
            }
            var wishLists = _wishListServices.GetWishLists(user);
            var selectedList = wishLists.SingleOrDefault(wp => wp.ContentItem.Id == id);
            if (selectedList == null) {
                selectedList = wishLists.SingleOrDefault(wp => wp.IsDefault);
            }
            return View(new WishListsIndexViewModel {
                CreateShape = _wishListServices.CreateShape(user),
                SettingsShape = _wishListServices.SettingsShape(user),
                WishLists = wishLists,
                WishList = selectedList,<commit_msg>removed output cache from index<commit_after>﻿using Nwazet.Commerce.Models;
using Nwazet.Commerce.Services;
using Nwazet.Commerce.ViewModels;
using Orchard;
using Orchard.ContentManagement;
using Orchard.Environment.Extensions;
using Orchard.Themes;
using Orchard.Workflows.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace Nwazet.Commerce.Controllers {
    [OrchardFeature("Nwazet.WishLists")]
    [Themed]
    public class WishListsController : Controller {
        private readonly IWorkContextAccessor _wca;
        private readonly IWishListServices _wishListServices;
        private readonly IContentManager _contentManager;
        private readonly IEnumerable<IProductAttributeExtensionProvider> _attributeExtensionProviders;
        private readonly IShoppingCart _shoppingCart;
        private readonly IWorkflowManager _workflowManager;

        public WishListsController(
            IWorkContextAccessor wca,
            IWishListServices wishListServices,
            IContentManager contentManager,
            IEnumerable<IProductAttributeExtensionProvider> attributeExtensionProviders,
            IShoppingCart shoppingCart,
            IWorkflowManager workflowManager) {

            _wca = wca;
            _wishListServices = wishListServices;
            _contentManager = contentManager;
            _attributeExtensionProviders = attributeExtensionProviders;
            _shoppingCart = shoppingCart;
            _workflowManager = workflowManager;
        }

        private const string AttributePrefix = "productattributes.a";
        private const string ExtensionPrefix = "ext.";

        [OutputCache(Duration = 0)]
        public ActionResult Index(int id = 0) {
            var user = _wca.GetContext().CurrentUser;
            if (user == null) {
                return new HttpUnauthorizedResult();
            }
            var wishLists = _wishListServices.GetWishLists(user);
            var selectedList = wishLists.SingleOrDefault(wp => wp.ContentItem.Id == id);
            if (selectedList == null) {
                selectedList = wishLists.SingleOrDefault(wp => wp.IsDefault);
            }
            return View(new WishListsIndexViewModel {
                CreateShape = _wishListServices.CreateShape(user),
                SettingsShape = _wishListServices.SettingsShape(user),
                WishLists = wishLists,
                WishList = selectedList,
{'fraction_non_alphanumeric': 0.06445783132530121, 'fraction_numerical': 0.0006024096385542169, 'mean_word_length': 2.8256528417818743, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5609048', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1231, 'n_words': 275}