コード例 #1
0
        public ActionResult AddSelectionDataItem(string attributeKey)
        {
            ViewBag.MenuItem = CurrentMenuItem;

            SelectionDataItemDetail newSelectionDataItem = new SelectionDataItemDetail();

            newSelectionDataItem.AttributeKey = attributeKey;
            ViewData.Model = newSelectionDataItem;

            return(View());
        }
コード例 #2
0
        public async Task AddSelectionDataItemAsync(SelectionDataItemDetail selectionDataItem)
        {
            var newSelectionDataItem = new SelectionDataItem()
            {
                AttributeKey = selectionDataItem.AttributeKey,
                Value        = selectionDataItem.DataItemValue,
                SelectionKey = selectionDataItem.SelectionKey
            };

            await _selectionDataItemRepository.SaveAsync(newSelectionDataItem);
        }
コード例 #3
0
        public void AddSelectionDataItem(SelectionDataItemDetail selectionDataItem)
        {
            var newSelectionDataItem = new SelectionDataItem()
            {
                AttributeKey = selectionDataItem.AttributeKey,
                Value        = selectionDataItem.DataItemValue,
                SelectionKey = selectionDataItem.SelectionKey
            };

            selectionDataRepository.Save(newSelectionDataItem);
        }
コード例 #4
0
        public async Task <bool> Handle(AddSelectionValueCommand message, CancellationToken cancellationToken)
        {
            var detail = new SelectionDataItemDetail()
            {
                AttributeKey  = message.AttributeKey,
                DataItemValue = message.DataItemValue,
                SelectionKey  = message.SelectionKey,
            };

            await _customAttributeService.AddSelectionDataItemAsync(detail);

            _logger.LogInformation($"----- Selection Data Item {message.AttributeKey} created");

            return(true);
        }
コード例 #5
0
        public ActionResult AddSelectionDataItem(SelectionDataItemDetail selectionDataItem)
        {
            ViewBag.MenuItem = CurrentMenuItem;

            TryValidateModel(selectionDataItem);
            if (ModelState.IsValid)
            {
                try
                {
                    customAttributeService.AddSelectionDataItem(selectionDataItem);
                    return(RedirectToAction("ViewSelectionDataItems", new { AttributeName = selectionDataItem.AttributeKey }));
                }
                catch (BusinessException bex)
                {
                    ModelState.AddModelError("Name", bex.Message);
                }
            }

            ViewData.Model = selectionDataItem;

            return(View());
        }