コード例 #1
0
        public async Task <IActionResult> Create(CheckoutAttributeModel model, bool continueEditing)
        {
            if (ModelState.IsValid)
            {
                var checkoutAttribute = await _checkoutAttributeViewModelService.InsertCheckoutAttributeModel(model);

                Success(_translationService.GetResource("Admin.Orders.CheckoutAttributes.Added"));
                return(continueEditing ? RedirectToAction("Edit", new { id = checkoutAttribute.Id }) : RedirectToAction("List"));
            }

            //If we got this far, something failed, redisplay form
            //tax categories
            await _checkoutAttributeViewModelService.PrepareTaxCategories(model, null, true);

            return(View(model));
        }
        public IActionResult Create(CheckoutAttributeModel model, bool continueEditing)
        {
            if (ModelState.IsValid)
            {
                var checkoutAttribute = _checkoutAttributeViewModelService.InsertCheckoutAttributeModel(model);
                SuccessNotification(_localizationService.GetResource("Admin.Catalog.Attributes.CheckoutAttributes.Added"));
                return(continueEditing ? RedirectToAction("Edit", new { id = checkoutAttribute.Id }) : RedirectToAction("List"));
            }

            //If we got this far, something failed, redisplay form
            //tax categories
            _checkoutAttributeViewModelService.PrepareTaxCategories(model, null, true);
            //Stores
            model.PrepareStoresMappingModel(null, true, _storeService);
            //ACL
            model.PrepareACLModel(null, true, _customerService);

            return(View(model));
        }