Пример #1
0
        public async Task <IActionResult> Edit(CustomerAttributeModel model, bool continueEditing)
        {
            var customerAttribute = await _customerAttributeService.GetCustomerAttributeById(model.Id);

            if (customerAttribute == null)
            {
                //No customer attribute found with the specified id
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                customerAttribute = await _customerAttributeViewModelService.UpdateCustomerAttributeModel(model, customerAttribute);

                SuccessNotification(_localizationService.GetResource("Admin.Customers.CustomerAttributes.Updated"));
                if (continueEditing)
                {
                    //selected tab
                    SaveSelectedTabIndex();

                    return(RedirectToAction("Edit", new { id = customerAttribute.Id }));
                }
                return(RedirectToAction("List"));
            }

            //If we got this far, something failed, redisplay form
            return(View(model));
        }