Пример #1
0
        public void UpdateCustomerActionTypeTest()
        {
            var customerActionType = _customerActionService.GetCustomerActionTypeById(_Id_CustomerActionType);

            customerActionType.Enabled = false;
            _customerActionService.UpdateCustomerActionType(customerActionType);
            Assert.IsFalse(customerActionType.Enabled);
        }
        public async Task UpdateCustomerActionTypeTest()
        {
            var customerActionType = await _customerActionService.GetCustomerActionTypeById(_Id_CustomerActionType);

            customerActionType.Enabled = false;
            await _customerActionService.UpdateCustomerActionType(customerActionType);

            Assert.IsFalse(customerActionType.Enabled);
        }
        public async Task <IActionResult> SaveTypes(IFormCollection form)
        {
            string formKey            = "checkbox_action_types";
            var    checkedActionTypes = form[formKey].ToString() != null ? form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x).ToList() : new List <string>();

            var activityTypes = await _customerActionService.GetCustomerActionType();

            foreach (var actionType in activityTypes)
            {
                actionType.Enabled = checkedActionTypes.Contains(actionType.Id);
                await _customerActionService.UpdateCustomerActionType(actionType);
            }
            SuccessNotification(_localizationService.GetResource("Admin.Customers.ActionType.Updated"));
            return(RedirectToAction("ListTypes"));
        }
        public ActionResult SaveTypes(FormCollection form)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageActions))
            {
                return(AccessDeniedView());
            }

            string formKey            = "checkbox_action_types";
            var    checkedActionTypes = form[formKey] != null ? form[formKey].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x).ToList() : new List <string>();

            var activityTypes = _customerActionService.GetCustomerActionType();

            foreach (var actionType in activityTypes)
            {
                actionType.Enabled = checkedActionTypes.Contains(actionType.Id);
                _customerActionService.UpdateCustomerActionType(actionType);
            }
            SuccessNotification(_localizationService.GetResource("Admin.Customers.ActionType.Updated"));
            return(RedirectToAction("ListTypes"));
        }