public virtual IActionResult Edit(ContractAttributeModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
            {
                return(AccessDeniedView());
            }

            var contractAttribute = _contractAttributeService.GetContractAttributeById(model.Id);

            if (contractAttribute == 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));
            }

            contractAttribute = model.ToEntity(contractAttribute);
            _contractAttributeService.UpdateContractAttribute(contractAttribute);

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

            //locales
            UpdateAttributeLocales(contractAttribute, model);

            SuccessNotification(_localizationService.GetResource("Admin.Contract.ContractAttributes.Updated"));

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

            //selected tab
            SaveSelectedTabName();

            return(RedirectToAction("Edit", new { id = contractAttribute.Id }));
        }
        public virtual IActionResult Create(ContractAttributeModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
            {
                return(AccessDeniedView());
            }

            if (ModelState.IsValid)
            {
                var contractAttribute = model.ToEntity <ContractAttribute>();
                _contractAttributeService.InsertContractAttribute(contractAttribute);

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

                //locales
                UpdateAttributeLocales(contractAttribute, model);

                SuccessNotification(_localizationService.GetResource("Admin.Contract.ContractAttribute.Added"));

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

                //selected tab
                SaveSelectedTabName();

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

            //prepare model
            model = _contractAttributeModelFactory.PrepareContractAttributeModel(model, null, true);

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