Esempio n. 1
0
        public BasketInstance(
            Controller controller,
            ModelStateDictionary modelState,
            BasketSubmits submit,
            DominosConfig config  = null,
            SessionHelper session = null,
            CookieHelper cookie   = null)
        {
            switch (submit)
            {
            case BasketSubmits.List:
                Provider = new BasketListProvider();
                break;

            case BasketSubmits.Delete:
                Provider = new BasketDeleteProvider();
                break;

            case BasketSubmits.Increase:
                Provider = new BasketIncreaseProvider();
                break;

            case BasketSubmits.Decrease:
                Provider = new BasketDescreaseProvider();
                break;
            }

            (Provider as BaseProvider).Controller = controller;
            (Provider as BaseProvider).ModelState = modelState;
            (Provider as BaseProvider).Config     = config;
            (Provider as BaseProvider).Session    = session;
            (Provider as BaseProvider).Cookie     = cookie;
        }
Esempio n. 2
0
        public IActionResult Index(BasketViewModel model, BasketSubmits submit)
        {
            var instance = new BasketInstance(this, ModelState, submit, _config, _session, _cookie);

            instance.Provider.Execute(model);

            return(View(model));
        }