public async Task<IActionResult> Edit(string id)
        {
            var customerAction = await _customerActionService.GetCustomerActionById(id);
            if (customerAction == null)
                return RedirectToAction("List");

            var model = customerAction.ToModel(_dateTimeHelper);
            model.ConditionCount = customerAction.Conditions.Count();
            await _customerActionViewModelService.PrepareReactObjectModel(model);
            return View(model);
        }
Exemplo n.º 2
0
        public IActionResult Edit(string id)
        {
            var customerAction = _customerActionService.GetCustomerActionById(id);

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

            var model = customerAction.ToModel();

            model.ConditionCount = customerAction.Conditions.Count();
            _customerActionViewModelService.PrepareReactObjectModel(model);
            return(View(model));
        }
        public void GetCustomerActionByIdTest()
        {
            var action = _customerActionService.GetCustomerActionById(_Id_CustomerAction);

            Assert.IsNotNull(action);
        }
        public virtual async Task <CustomerActionConditionModel> PrepareCustomerActionConditionModel(string customerActionId)
        {
            var customerAction = await _customerActionService.GetCustomerActionById(customerActionId);

            var actionType = await _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);
        }