public async Task <IActionResult> EditCondition(string customerActionId, string cid)
        {
            var customerAction = await _customerActionService.GetCustomerActionById(customerActionId);

            if (customerAction == null)
            {
                return(RedirectToAction("List"));
            }
            var actionType = await _customerActionService.GetCustomerActionTypeById(customerAction.ActionTypeId);

            var condition = customerAction.Conditions.FirstOrDefault(x => x.Id == cid);

            if (condition == null)
            {
                return(RedirectToAction("List"));
            }

            var model = condition.ToModel();

            model.CustomerActionId = customerActionId;

            foreach (var item in actionType.ConditionType)
            {
                model.CustomerActionConditionType.Add(new SelectListItem()
                {
                    Value = item.ToString(),
                    Text  = ((CustomerActionConditionTypeEnum)item).ToString()
                });
            }

            return(View(model));
        }
Пример #2
0
        public IActionResult List(DataSourceRequest command)
        {
            var customeractions = _customerActionService.GetCustomerActions();
            var gridModel       = new DataSourceResult
            {
                Data  = customeractions.Select(x => new { Id = x.Id, Name = x.Name, Active = x.Active, ActionType = _customerActionService.GetCustomerActionTypeById(x.ActionTypeId).Name }),
                Total = customeractions.Count()
            };

            return(Json(gridModel));
        }
        public virtual CustomerActionConditionModel PrepareCustomerActionConditionModel(string customerActionId)
        {
            var customerAction = _customerActionService.GetCustomerActionById(customerActionId);
            var actionType     = _customerActionService.GetCustomerActionTypeById(customerAction.ActionTypeId);

            var model = new CustomerActionConditionModel();

            model.CustomerActionId = customerActionId;

            foreach (var item in actionType.ConditionType)
            {
                model.CustomerActionConditionType.Add(new SelectListItem()
                {
                    Value = item.ToString(),
                    Text  = ((CustomerActionConditionTypeEnum)item).ToString()
                });
            }
            return(model);
        }
        public async Task GetCustomerActionTypeByIdTest()
        {
            var customerActionType = await _customerActionService.GetCustomerActionTypeById(_Id_CustomerActionType);

            Assert.IsNotNull(customerActionType);
        }
Пример #5
0
        public void GetCustomerActionTypeByIdTest()
        {
            var customerActionType = _customerActionService.GetCustomerActionTypeById(_Id_CustomerActionType);

            Assert.IsNotNull(customerActionType);
        }