Ejemplo n.º 1
0
        public virtual async Task <CustomerAttribute> UpdateCustomerAttributeModel(CustomerAttributeModel model, CustomerAttribute customerAttribute)
        {
            customerAttribute = model.ToEntity(customerAttribute);
            await _customerAttributeService.UpdateCustomerAttribute(customerAttribute);

            return(customerAttribute);
        }
Ejemplo n.º 2
0
        public ActionResult Edit(CustomerAttributeModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
            {
                return(AccessDeniedView());
            }

            var customerAttribute = _customerAttributeService.GetCustomerAttributeById(model.Id);

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

            if (ModelState.IsValid)
            {
                customerAttribute         = model.ToEntity(customerAttribute);
                customerAttribute.Locales = UpdateAttributeLocales(customerAttribute, model);
                _customerAttributeService.UpdateCustomerAttribute(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));
        }
        public virtual async Task <CustomerAttribute> UpdateCustomerAttributeModel(CustomerAttributeModel model, CustomerAttribute customerAttribute)
        {
            customerAttribute = model.ToEntity(customerAttribute);
            if (customerAttribute.IsReadOnly && customerAttribute.IsRequired)
            {
                customerAttribute.IsRequired = false;
            }

            await _customerAttributeService.UpdateCustomerAttribute(customerAttribute);

            return(customerAttribute);
        }
Ejemplo n.º 4
0
        public virtual IActionResult Edit(CustomerAttributeModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
            {
                return(AccessDeniedView());
            }

            var customerAttribute = _customerAttributeService.GetCustomerAttributeById(model.Id);

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

            if (!ModelState.IsValid)
            {
                //if we got this far, something failed, redisplay form
                return(View(model));
            }

            customerAttribute = model.ToEntity(customerAttribute);
            _customerAttributeService.UpdateCustomerAttribute(customerAttribute);

            //activity log
            _customerActivityService.InsertActivity("EditCustomerAttribute",
                                                    string.Format(_localizationService.GetResource("ActivityLog.EditCustomerAttribute"), customerAttribute.Id),
                                                    customerAttribute);

            //locales
            UpdateAttributeLocales(customerAttribute, model);

            SuccessNotification(_localizationService.GetResource("Admin.Customers.CustomerAttributes.Updated"));

            if (!continueEditing)
            {
                return(RedirectToAction("List"));
            }

            //selected tab
            SaveSelectedTabName();

            return(RedirectToAction("Edit", new { id = customerAttribute.Id }));
        }
 public virtual CustomerAttribute UpdateCustomerAttributeModel(CustomerAttributeModel model, CustomerAttribute customerAttribute)
 {
     customerAttribute = model.ToEntity(customerAttribute);
     _customerAttributeService.UpdateCustomerAttribute(customerAttribute);
     return(customerAttribute);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Updates the customer attribute
 /// </summary>
 /// <param name="customerAttribute">Customer attribute</param>
 public void UpdateCustomerAttribute(CustomerAttribute customerAttribute)
 {
     _customerAttributeService.UpdateCustomerAttribute(customerAttribute);
 }