public virtual CustomerTag InsertCustomerTagModel(CustomerTagModel model)
        {
            var customertag = model.ToEntity();

            customertag.Name = customertag.Name.ToLower();
            _customerTagService.InsertCustomerTag(customertag);

            //activity log
            _customerActivityService.InsertActivity("AddNewCustomerTag", customertag.Id, _localizationService.GetResource("ActivityLog.AddNewCustomerTag"), customertag.Name);
            return(customertag);
        }
Example #2
0
        public virtual async Task <CustomerTag> InsertCustomerTagModel(CustomerTagModel model)
        {
            var customertag = model.ToEntity();

            customertag.Name = customertag.Name.ToLower();
            await _customerTagService.InsertCustomerTag(customertag);

            //activity log
            await _customerActivityService.InsertActivity("AddNewCustomerTag", customertag.Id, _translationService.GetResource("ActivityLog.AddNewCustomerTag"), customertag.Name);

            return(customertag);
        }
        public IActionResult Create(CustomerTagModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers))
                return AccessDeniedView();

            if (ModelState.IsValid)
            {
                var customertag = model.ToEntity();
                customertag.Name = customertag.Name.ToLower();
                _customerTagService.InsertCustomerTag(customertag);

                //activity log
                _customerActivityService.InsertActivity("AddNewCustomerTag", customertag.Id, _localizationService.GetResource("ActivityLog.AddNewCustomerTag"), customertag.Name);

                SuccessNotification(_localizationService.GetResource("Admin.Customers.CustomerTags.Added"));
                return continueEditing ? RedirectToAction("Edit", new { id = customertag.Id }) : RedirectToAction("List");
            }

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