Ejemplo n.º 1
0
        public IActionResult Edit(string id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers))
                return AccessDeniedView();

            var customerTag = _customerTagService.GetCustomerTagById(id);
            if (customerTag == null)
                //No customer role found with the specified id
                return RedirectToAction("List");

            var model = customerTag.ToModel();
            return View(model);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(string id)
        {
            var customerTag = await _customerTagService.GetCustomerTagById(id);

            if (customerTag == null)
            {
                //No customer role found with the specified id
                return(RedirectToAction("List"));
            }

            var model = customerTag.ToModel();

            return(View(model));
        }
 public async Task<IActionResult> ConditionCustomerTag(string customerActionId, string conditionId)
 {
     var customerActions = await _customerActionService.GetCustomerActionById(customerActionId);
     var condition = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);
     var items = new List<(string Id, string CustomerTag)>();
     foreach (var item in condition.CustomerTags)
     {
         var tag = (await _customerTagService.GetCustomerTagById(item))?.Name;
         items.Add((item, tag));
     }
     var gridModel = new DataSourceResult
     {
         Data = items.Select(x => new { Id = x.Id, CustomerTag = x.CustomerTag }),
         Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
     };
     return Json(gridModel);
 }
Ejemplo n.º 4
0
        public IActionResult ConditionCustomerTag(string customerActionId, string conditionId)
        {
            var customerActions = _customerActionService.GetCustomerActionById(customerActionId);
            var condition       = customerActions.Conditions.FirstOrDefault(x => x.Id == conditionId);

            var gridModel = new DataSourceResult
            {
                Data                         = condition != null?condition.CustomerTags.Select(z => new { Id = z, CustomerTag = _customerTagService.GetCustomerTagById(z) != null ? _customerTagService.GetCustomerTagById(z).Name : "" }) : null,
                                       Total = customerActions.Conditions.Where(x => x.Id == conditionId).Count()
            };

            return(Json(gridModel));
        }